diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-02-17 17:32:16 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-02-17 17:32:16 -0800 |
| commit | ba8ce4c2c27643cccfbbc481a19bcf4b7747cc89 (patch) | |
| tree | 158a22ef66d1d80f0e9e5d01dffb13496af236c2 /src/libstd/sync/task_pool.rs | |
| parent | 6ac3799b75780f8c18bc38331403e1e517b89bab (diff) | |
| parent | 7a14f4994eb4527a38d02c61fa83822df02f7b5d (diff) | |
| download | rust-ba8ce4c2c27643cccfbbc481a19bcf4b7747cc89.tar.gz rust-ba8ce4c2c27643cccfbbc481a19bcf4b7747cc89.zip | |
rollup merge of #22319: huonw/send-is-not-static
Conflicts: src/libstd/sync/task_pool.rs src/libstd/thread.rs src/libtest/lib.rs src/test/bench/shootout-reverse-complement.rs src/test/bench/shootout-spectralnorm.rs
Diffstat (limited to 'src/libstd/sync/task_pool.rs')
| -rw-r--r-- | src/libstd/sync/task_pool.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstd/sync/task_pool.rs b/src/libstd/sync/task_pool.rs index 06c0c84c418..f4274dd91cc 100644 --- a/src/libstd/sync/task_pool.rs +++ b/src/libstd/sync/task_pool.rs @@ -24,12 +24,12 @@ 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,13 +105,13 @@ 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>>>) { +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); |
