Simplify the schedule_do function of the scheduler.
Simplify the schedule_do function of the scheduler.

Use atomic operations wherever it makes sense since this stuff needs to be
properly synchronised.

winlinvip/feng,lscube/feng,winlinvip/feng,lscube/feng,lscube/feng,winlinvip/feng