diff options
| author | toddaaro <github@opprobrio.us> | 2013-08-05 13:06:24 -0700 |
|---|---|---|
| committer | toddaaro <github@opprobrio.us> | 2013-08-08 14:13:41 -0700 |
| commit | af2e03998d4d06f2781ca72ec005f6913148f8bb (patch) | |
| tree | fc65de2220eb4735ef6fdf554b5c7204ec41d6b1 /src/libstd/rt/comm.rs | |
| parent | a0080f4e07891c89aa1f9851f8b0a3c754734fe8 (diff) | |
Enabled workstealing in the scheduler. Previously we had one global work queue shared by each scheduler. Now there is a separate work queue for each scheduler, and work is "stolen" from other queues when it is exhausted locally.
Diffstat (limited to 'src/libstd/rt/comm.rs')
| -rw-r--r-- | src/libstd/rt/comm.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libstd/rt/comm.rs b/src/libstd/rt/comm.rs index 0cf223f3029..33b4b307af8 100644 --- a/src/libstd/rt/comm.rs +++ b/src/libstd/rt/comm.rs @@ -225,9 +225,10 @@ impl<T> Select for PortOne<T> { fn optimistic_check(&mut self) -> bool { // The optimistic check is never necessary for correctness. For testing // purposes, making it randomly return false simulates a racing sender. - use rand::{Rand, rng}; - let mut rng = rng(); - let actually_check = Rand::rand(&mut rng); + use rand::{Rand}; + let actually_check = do Local::borrow::<Scheduler, bool> |sched| { + Rand::rand(&mut sched.rng) + }; if actually_check { unsafe { (*self.packet()).state.load(Acquire) == STATE_ONE } } else { |
