Tweak the scheduler to avoid busy-waiting.
Merge pull request #248 from cgjones/sched-no-spin

Tweak the scheduler to avoid busy-waiting.