diff options
| author | Brian Anderson <banderson@mozilla.com> | 2013-06-13 22:43:20 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2013-06-13 23:18:49 -0700 |
| commit | fd148cd3e2d08ce15272f0690f6e41d2e85ee721 (patch) | |
| tree | 80aa3c6252d68a5bf40117d4753e323a13695386 /src/libstd/task | |
| parent | abc3a8aa1e76f3ecc3930e20453a52681843cec0 (diff) | |
| download | rust-fd148cd3e2d08ce15272f0690f6e41d2e85ee721.tar.gz rust-fd148cd3e2d08ce15272f0690f6e41d2e85ee721.zip | |
std::rt: Change the Task constructors to reflect a tree
Diffstat (limited to 'src/libstd/task')
| -rw-r--r-- | src/libstd/task/spawn.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs index 5941221821a..a4fbec11d72 100644 --- a/src/libstd/task/spawn.rs +++ b/src/libstd/task/spawn.rs @@ -91,6 +91,7 @@ use uint; use util; use unstable::sync::{Exclusive, exclusive}; use rt::local::Local; +use rt::task::Task; #[cfg(test)] use task::default_task_opts; @@ -576,8 +577,14 @@ pub fn spawn_raw(opts: TaskOpts, f: ~fn()) { fn spawn_raw_newsched(_opts: TaskOpts, f: ~fn()) { use rt::sched::*; + let mut task = None; + do Local::borrow::<Task>() |running_task| { + task = Some(~running_task.new_child_without_unwinding()); + } + let mut sched = Local::take::<Scheduler>(); - let task = ~Coroutine::new(&mut sched.stack_pool, f); + let task = ~Coroutine::with_task(&mut sched.stack_pool, + task.swap_unwrap(), f); sched.schedule_new_task(task); } |
