]> git.lizzy.rs Git - rust.git/commit
std::rt: Don't allow schedulers to exit before handling all messages
authorBrian Anderson <banderson@mozilla.com>
Sun, 4 Aug 2013 06:29:21 +0000 (23:29 -0700)
committerBrian Anderson <banderson@mozilla.com>
Sun, 4 Aug 2013 22:11:56 +0000 (15:11 -0700)
commita27f339cb4480e723aa7e06070683966d026d1ae
tree69284728b4a806e428443a733a88635b1215e703
parentf0f7e1b3fcfed8b77516a871ae82a4aa8df07764
std::rt: Don't allow schedulers to exit before handling all messages

Every time run_sched_once performs a 'scheduling action' it needs to guarantee
that it runs at least one more time, so enqueue another run_sched_once callback.
The primary reason it needs to do this is because not all async callbacks
are guaranteed to run, it's only guaranteed that *a* callback will run after
enqueing one - some may get dropped.

At the moment this means we wastefully create lots of callbacks to ensure that
there will *definitely* be a callback queued up to continue running the scheduler.
The logic really needs to be tightened up here.
src/libstd/rt/sched.rs