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/rt/test.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/rt/test.rs')
| -rw-r--r-- | src/libstd/rt/test.rs | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/src/libstd/rt/test.rs b/src/libstd/rt/test.rs index 2ab543a4c36..96b80d11129 100644 --- a/src/libstd/rt/test.rs +++ b/src/libstd/rt/test.rs @@ -10,7 +10,6 @@ use io::net::ip::{SocketAddr, Ipv4Addr, Ipv6Addr}; -use cell::Cell; use clone::Clone; use container::Container; use iter::{Iterator, range}; @@ -65,16 +64,14 @@ pub fn new_test_sched() -> Scheduler { } pub fn run_in_uv_task(f: proc()) { - let f = Cell::new(f); do run_in_bare_thread { - run_in_uv_task_core(f.take()); + run_in_uv_task_core(f); } } pub fn run_in_newsched_task(f: proc()) { - let f = Cell::new(f); do run_in_bare_thread { - run_in_newsched_task_core(f.take()); + run_in_newsched_task_core(f); } } @@ -206,8 +203,6 @@ pub fn run_in_mt_newsched_task(f: proc()) { // see comment in other function (raising fd limits) prepare_for_lots_of_tests(); - let f = Cell::new(f); - do run_in_bare_thread { let nthreads = match os::getenv("RUST_RT_TEST_THREADS") { Some(nstr) => FromStr::from_str(nstr).unwrap(), @@ -254,18 +249,18 @@ pub fn run_in_mt_newsched_task(f: proc()) { rtassert!(exit_status.is_success()); }; - let mut main_task = ~Task::new_root(&mut scheds[0].stack_pool, None, f.take()); + let mut main_task = ~Task::new_root(&mut scheds[0].stack_pool, + None, + f); main_task.death.on_exit = Some(on_exit); let mut threads = ~[]; - let main_task = Cell::new(main_task); let main_thread = { let sched = scheds.pop(); - let sched_cell = Cell::new(sched); + let main_task = main_task; do Thread::start { - let sched = sched_cell.take(); - sched.bootstrap(main_task.take()); + sched.bootstrap(main_task); } }; threads.push(main_thread); @@ -275,11 +270,9 @@ pub fn run_in_mt_newsched_task(f: proc()) { let bootstrap_task = ~do Task::new_root(&mut sched.stack_pool, None) || { rtdebug!("bootstrapping non-primary scheduler"); }; - let bootstrap_task_cell = Cell::new(bootstrap_task); - let sched_cell = Cell::new(sched); + let sched = sched; let thread = do Thread::start { - let sched = sched_cell.take(); - sched.bootstrap(bootstrap_task_cell.take()); + sched.bootstrap(bootstrap_task); }; threads.push(thread); @@ -335,11 +328,8 @@ pub fn spawntask_try(f: proc()) -> Result<(),()> { /// Spawn a new task in a new scheduler and return a thread handle. pub fn spawntask_thread(f: proc()) -> Thread<()> { - - let f = Cell::new(f); - let thread = do Thread::start { - run_in_newsched_task_core(f.take()); + run_in_newsched_task_core(f); }; return thread; |
