diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2014-11-26 08:12:18 -0500 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2014-12-14 04:21:56 -0500 |
| commit | 5c3d3989192f88b16f39d554c3844700c91b6c8e (patch) | |
| tree | 59c77544a06d3f4c2d363b5afe37c91a444e78d6 /src/libstd/sync/task_pool.rs | |
| parent | 394f6846b80240480f8d7ce4b3d5d4c42ba85201 (diff) | |
| download | rust-5c3d3989192f88b16f39d554c3844700c91b6c8e.tar.gz rust-5c3d3989192f88b16f39d554c3844700c91b6c8e.zip | |
Mostly rote conversion of `proc()` to `move||` (and occasionally `Thunk::new`)
Diffstat (limited to 'src/libstd/sync/task_pool.rs')
| -rw-r--r-- | src/libstd/sync/task_pool.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/libstd/sync/task_pool.rs b/src/libstd/sync/task_pool.rs index a684c6502ae..fa5b62a202b 100644 --- a/src/libstd/sync/task_pool.rs +++ b/src/libstd/sync/task_pool.rs @@ -12,17 +12,18 @@ use core::prelude::*; -use task::spawn; +use task::{spawn}; use comm::{channel, Sender, Receiver}; use sync::{Arc, Mutex}; +use thunk::Thunk; struct Sentinel<'a> { - jobs: &'a Arc<Mutex<Receiver<proc(): Send>>>, + jobs: &'a Arc<Mutex<Receiver<Thunk>>>, active: bool } impl<'a> Sentinel<'a> { - fn new(jobs: &Arc<Mutex<Receiver<proc(): Send>>>) -> Sentinel { + fn new(jobs: &Arc<Mutex<Receiver<Thunk>>>) -> Sentinel { Sentinel { jobs: jobs, active: true @@ -60,7 +61,7 @@ impl<'a> Drop for Sentinel<'a> { /// let (tx, rx) = channel(); /// for _ in range(0, 8u) { /// let tx = tx.clone(); -/// pool.execute(proc() { +/// pool.execute(move|| { /// tx.send(1u); /// }); /// } @@ -146,7 +147,7 @@ mod test { let (tx, rx) = channel(); for _ in range(0, TEST_TASKS) { let tx = tx.clone(); - pool.execute(proc() { + pool.execute(move|| { tx.send(1u); }); } @@ -168,14 +169,14 @@ mod test { // Panic all the existing tasks. for _ in range(0, TEST_TASKS) { - pool.execute(proc() { panic!() }); + pool.execute(move|| -> () { panic!() }); } // Ensure new tasks were spawned to compensate. let (tx, rx) = channel(); for _ in range(0, TEST_TASKS) { let tx = tx.clone(); - pool.execute(proc() { + pool.execute(move|| { tx.send(1u); }); } @@ -193,7 +194,7 @@ mod test { // Panic all the existing tasks in a bit. for _ in range(0, TEST_TASKS) { let waiter = waiter.clone(); - pool.execute(proc() { + pool.execute(move|| { waiter.wait(); panic!(); }); |
