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/thread.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/thread.rs')
| -rw-r--r-- | src/libstd/thread.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/thread.rs b/src/libstd/thread.rs index a8355c34000..ea25ddc0fca 100644 --- a/src/libstd/thread.rs +++ b/src/libstd/thread.rs @@ -172,9 +172,9 @@ pub struct Builder { // The size of the stack for the spawned thread stack_size: Option<uint>, // Thread-local stdout - stdout: Option<Box<Writer + Send>>, + stdout: Option<Box<Writer + Send + 'static>>, // Thread-local stderr - stderr: Option<Box<Writer + Send>>, + stderr: Option<Box<Writer + Send + 'static>>, } impl Builder { @@ -208,7 +208,7 @@ impl Builder { /// Redirect thread-local stdout. #[unstable(feature = "std_misc", reason = "Will likely go away after proc removal")] - pub fn stdout(mut self, stdout: Box<Writer + Send>) -> Builder { + pub fn stdout(mut self, stdout: Box<Writer + Send + 'static>) -> Builder { self.stdout = Some(stdout); self } @@ -216,7 +216,7 @@ impl Builder { /// Redirect thread-local stderr. #[unstable(feature = "std_misc", reason = "Will likely go away after proc removal")] - pub fn stderr(mut self, stderr: Box<Writer + Send>) -> Builder { + pub fn stderr(mut self, stderr: Box<Writer + Send + 'static>) -> Builder { self.stderr = Some(stderr); self } @@ -565,11 +565,11 @@ impl thread_info::NewThread for Thread { /// /// A thread that completes without panicking is considered to exit successfully. #[stable(feature = "rust1", since = "1.0.0")] -pub type Result<T> = ::result::Result<T, Box<Any + Send>>; +pub type Result<T> = ::result::Result<T, Box<Any + Send + 'static>>; struct Packet<T>(Arc<UnsafeCell<Option<Result<T>>>>); -unsafe impl<T:'static+Send> Send for Packet<T> {} +unsafe impl<T:Send> Send for Packet<T> {} unsafe impl<T> Sync for Packet<T> {} /// Inner representation for JoinHandle and JoinGuard @@ -804,7 +804,7 @@ mod test { rx.recv().unwrap(); } - fn avoid_copying_the_body<F>(spawnfn: F) where F: FnOnce(Thunk) { + fn avoid_copying_the_body<F>(spawnfn: F) where F: FnOnce(Thunk<'static>) { let (tx, rx) = channel::<uint>(); let x = box 1; @@ -851,7 +851,7 @@ mod test { // (well, it would if the constant were 8000+ - I lowered it to be more // valgrind-friendly. try this at home, instead..!) static GENERATIONS: uint = 16; - fn child_no(x: uint) -> Thunk { + fn child_no(x: uint) -> Thunk<'static> { return Thunk::new(move|| { if x < GENERATIONS { thread::spawn(move|| child_no(x+1).invoke(())); |
