diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-12-03 16:44:16 -0800 | 
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-12-10 15:13:12 -0800 | 
| commit | 786dea207d5b891d37e596e96dd2f84c4cb59f49 (patch) | |
| tree | f275936b26e6602b11363446fcac5ad3b09dbe92 /src/libstd/task/spawn.rs | |
| parent | 5aad292fb99f7e9a2730b35ed535bda0ab9c6117 (diff) | |
| download | rust-786dea207d5b891d37e596e96dd2f84c4cb59f49.tar.gz rust-786dea207d5b891d37e596e96dd2f84c4cb59f49.zip | |
libextra: Another round of de-`Cell`-ing.
34 uses of `Cell` remain.
Diffstat (limited to 'src/libstd/task/spawn.rs')
| -rw-r--r-- | src/libstd/task/spawn.rs | 16 | 
1 files changed, 5 insertions, 11 deletions
| diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs index 153b3e4ce25..4ab7b74d300 100644 --- a/src/libstd/task/spawn.rs +++ b/src/libstd/task/spawn.rs @@ -77,7 +77,6 @@ use prelude::*; -use cell::Cell; use comm::{GenericChan, oneshot}; use rt::local::Local; use rt::sched::{Scheduler, Shutdown, TaskFromFriend}; @@ -134,23 +133,19 @@ pub fn spawn_raw(mut opts: TaskOpts, f: proc()) { // Create a task that will later be used to join with the new scheduler // thread when it is ready to terminate let (thread_port, thread_chan) = oneshot(); - let thread_port_cell = Cell::new(thread_port); let join_task = do Task::build_child(None) { debug!("running join task"); - let thread_port = thread_port_cell.take(); let thread: Thread<()> = thread_port.recv(); thread.join(); }; // Put the scheduler into another thread - let new_sched_cell = Cell::new(new_sched); - let orig_sched_handle_cell = Cell::new((*sched).make_handle()); - let join_task_cell = Cell::new(join_task); + let orig_sched_handle = (*sched).make_handle(); + let new_sched = new_sched; let thread = do Thread::start { - let mut new_sched = new_sched_cell.take(); - let mut orig_sched_handle = orig_sched_handle_cell.take(); - let join_task = join_task_cell.take(); + let mut new_sched = new_sched; + let mut orig_sched_handle = orig_sched_handle; let bootstrap_task = ~do Task::new_root(&mut new_sched.stack_pool, None) || { debug!("boostrapping a 1:1 scheduler"); @@ -178,9 +173,8 @@ pub fn spawn_raw(mut opts: TaskOpts, f: proc()) { if opts.notify_chan.is_some() { let notify_chan = opts.notify_chan.take_unwrap(); - let notify_chan = Cell::new(notify_chan); let on_exit: proc(UnwindResult) = proc(task_result) { - notify_chan.take().send(task_result) + notify_chan.send(task_result) }; task.death.on_exit = Some(on_exit); } | 
