diff options
| author | bors <bors@rust-lang.org> | 2013-10-15 22:56:36 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-10-15 22:56:36 -0700 |
| commit | fabec998e5667d651d3475c12ee25ab97d21105c (patch) | |
| tree | cfe7a7fda00903a99ecdf9bab0f98eeb85fe356f /src/libstd/rt | |
| parent | 3d75ec56931c3c6b27707e003a00385b5f01ecbc (diff) | |
| parent | 818ebf2ed6c6f61d0a2ec86cb104c4467b28d75e (diff) | |
| download | rust-fabec998e5667d651d3475c12ee25ab97d21105c.tar.gz rust-fabec998e5667d651d3475c12ee25ab97d21105c.zip | |
auto merge of #9857 : brson/rust/mainsched, r=alexcrichton
...al work This is causing really awful scheduler behavior where the main thread scheduler is continually waking up, stealing work, discovering it can't actually run the work, and sending it off to another scheduler. No test cases because we don't have suitable instrumentation for it.
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/mod.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index 78f0bb0a07c..9ea7b734d24 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -310,8 +310,14 @@ fn run_(main: ~fn(), use_main_sched: bool) -> int { sleepers.clone(), false, Some(friend_handle)); - let main_handle = main_sched.make_handle(); - handles.push(main_handle); + let mut main_handle = main_sched.make_handle(); + // Allow the scheduler to exit when the main task exits. + // Note: sending the shutdown message also prevents the scheduler + // from pushing itself to the sleeper list, which is used for + // waking up schedulers for work stealing; since this is a + // non-work-stealing scheduler it should not be adding itself + // to the list. + main_handle.send_shutdown(); Some(main_sched) } else { None |
