diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2015-02-18 23:50:21 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2015-02-18 23:50:21 +1100 |
| commit | dfc5c0f1e8799f47f9033bdcc8a7cd8a217620a5 (patch) | |
| tree | e9c32f2e58b3462a23dd9c472d2f236640b78811 /src/libstd/sync/task_pool.rs | |
| parent | 6c065fc8cb036785f61ff03e05c1563cbb2dd081 (diff) | |
| parent | 47f91a9484eceef10536d4caac6ef578cd254567 (diff) | |
| download | rust-dfc5c0f1e8799f47f9033bdcc8a7cd8a217620a5.tar.gz rust-dfc5c0f1e8799f47f9033bdcc8a7cd8a217620a5.zip | |
Manual merge of #22475 - alexcrichton:rollup, r=alexcrichton
One windows bot failed spuriously.
Diffstat (limited to 'src/libstd/sync/task_pool.rs')
| -rw-r--r-- | src/libstd/sync/task_pool.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libstd/sync/task_pool.rs b/src/libstd/sync/task_pool.rs index 684a46fd6ff..f4274dd91cc 100644 --- a/src/libstd/sync/task_pool.rs +++ b/src/libstd/sync/task_pool.rs @@ -20,16 +20,16 @@ use core::prelude::*; use sync::{Arc, Mutex}; use sync::mpsc::{channel, Sender, Receiver}; -use thread::Thread; +use thread; use thunk::Thunk; struct Sentinel<'a> { - jobs: &'a Arc<Mutex<Receiver<Thunk>>>, + jobs: &'a Arc<Mutex<Receiver<Thunk<'static>>>>, active: bool } impl<'a> Sentinel<'a> { - fn new(jobs: &Arc<Mutex<Receiver<Thunk>>>) -> Sentinel { + fn new(jobs: &'a Arc<Mutex<Receiver<Thunk<'static>>>>) -> Sentinel<'a> { Sentinel { jobs: jobs, active: true @@ -80,7 +80,7 @@ pub struct TaskPool { // // This is the only such Sender, so when it is dropped all subthreads will // quit. - jobs: Sender<Thunk> + jobs: Sender<Thunk<'static>> } impl TaskPool { @@ -105,14 +105,14 @@ impl TaskPool { /// Executes the function `job` on a thread in the pool. pub fn execute<F>(&self, job: F) - where F : FnOnce(), F : Send + where F : FnOnce(), F : Send + 'static { self.jobs.send(Thunk::new(job)).unwrap(); } } -fn spawn_in_pool(jobs: Arc<Mutex<Receiver<Thunk>>>) { - Thread::spawn(move || { +fn spawn_in_pool(jobs: Arc<Mutex<Receiver<Thunk<'static>>>>) { + thread::spawn(move || { // Will spawn a new thread on panic unless it is cancelled. let sentinel = Sentinel::new(&jobs); |
