diff options
| author | Brian Anderson <banderson@mozilla.com> | 2013-06-20 12:17:00 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2013-06-20 12:17:00 -0700 |
| commit | 357f087786cbd6516a38aff800cf9334bc5b85c5 (patch) | |
| tree | e3582c4e0f16927c4dc1c377cf789b469cde8196 /src/libstd/task | |
| parent | adeb7e77ccff938c0afb105a14a2ff4df4c7efc8 (diff) | |
| parent | 4d39253a9623ff30c27cee3c9770634a41f4412d (diff) | |
| download | rust-357f087786cbd6516a38aff800cf9334bc5b85c5.tar.gz rust-357f087786cbd6516a38aff800cf9334bc5b85c5.zip | |
Merge remote-tracking branch 'brson/io' into io-upstream
Conflicts: src/rt/rust_builtin.cpp src/rt/rustrt.def.in
Diffstat (limited to 'src/libstd/task')
| -rw-r--r-- | src/libstd/task/mod.rs | 15 | ||||
| -rw-r--r-- | src/libstd/task/spawn.rs | 10 |
2 files changed, 10 insertions, 15 deletions
diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs index 223afbce091..99858feab22 100644 --- a/src/libstd/task/mod.rs +++ b/src/libstd/task/mod.rs @@ -520,20 +520,9 @@ pub fn failing() -> bool { } } _ => { - let mut unwinding = false; - do Local::borrow::<Task> |local| { - unwinding = match local.unwinder { - Some(unwinder) => { - unwinder.unwinding - } - None => { - // Because there is no unwinder we can't be unwinding. - // (The process will abort on failure) - false - } - } + do Local::borrow::<Task, bool> |local| { + local.unwinder.unwinding } - return unwinding; } } } diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs index 77053f39677..344a58a877f 100644 --- a/src/libstd/task/spawn.rs +++ b/src/libstd/task/spawn.rs @@ -92,6 +92,7 @@ use util; use unstable::sync::{Exclusive, exclusive}; use rt::local::Local; use iterator::{IteratorUtil}; +use rt::task::Task; #[cfg(test)] use task::default_task_opts; #[cfg(test)] use comm; @@ -580,9 +581,14 @@ pub fn spawn_raw(opts: TaskOpts, f: ~fn()) { fn spawn_raw_newsched(_opts: TaskOpts, f: ~fn()) { use rt::sched::*; + let task = do Local::borrow::<Task, ~Task>() |running_task| { + ~running_task.new_child() + }; + let mut sched = Local::take::<Scheduler>(); - let task = ~Coroutine::new(&mut sched.stack_pool, f); - sched.schedule_new_task(task); + let task = ~Coroutine::with_task(&mut sched.stack_pool, + task, f); + sched.schedule_task(task); } fn spawn_raw_oldsched(mut opts: TaskOpts, f: ~fn()) { |
