diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-06-14 11:03:34 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-06-15 23:30:24 -0700 |
| commit | 89b0e6e12ba2fb24ec0e6655a1130c16eb8d1745 (patch) | |
| tree | 842308cfd38935989d625db41ffdd22758f8acdb /src/libstd/task.rs | |
| parent | 6d8342f5e9f7093694548e761ee7df4f55243f3f (diff) | |
| download | rust-89b0e6e12ba2fb24ec0e6655a1130c16eb8d1745.tar.gz rust-89b0e6e12ba2fb24ec0e6655a1130c16eb8d1745.zip | |
Register new snapshots
Diffstat (limited to 'src/libstd/task.rs')
| -rw-r--r-- | src/libstd/task.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/libstd/task.rs b/src/libstd/task.rs index a4e1ad84252..f543188af42 100644 --- a/src/libstd/task.rs +++ b/src/libstd/task.rs @@ -63,9 +63,9 @@ pub struct TaskOpts { /// The size of the stack for the spawned task pub stack_size: Option<uint>, /// Task-local stdout - pub stdout: Option<Box<Writer:Send>>, + pub stdout: Option<Box<Writer + Send>>, /// Task-local stderr - pub stderr: Option<Box<Writer:Send>>, + pub stderr: Option<Box<Writer + Send>>, } /** @@ -83,7 +83,7 @@ pub struct TaskOpts { pub struct TaskBuilder { /// Options to spawn the new task with pub opts: TaskOpts, - gen_body: Option<proc(v: proc():Send):Send -> proc():Send>, + gen_body: Option<proc(v: proc(): Send): Send -> proc(): Send>, nocopy: marker::NoCopy, } @@ -146,7 +146,7 @@ impl TaskBuilder { * existing body generator to the new body generator. */ pub fn with_wrapper(mut self, - wrapper: proc(v: proc():Send):Send -> proc():Send) + wrapper: proc(v: proc(): Send): Send -> proc(): Send) -> TaskBuilder { self.gen_body = match self.gen_body.take() { @@ -163,7 +163,7 @@ impl TaskBuilder { * the provided unique closure. The task has the properties and behavior * specified by the task_builder. */ - pub fn spawn(mut self, f: proc():Send) { + pub fn spawn(mut self, f: proc(): Send) { let gen_body = self.gen_body.take(); let f = match gen_body { Some(gen) => gen(f), @@ -204,8 +204,8 @@ impl TaskBuilder { * # Failure * Fails if a future_result was already set for this task. */ - pub fn try<T:Send>(mut self, f: proc():Send -> T) - -> Result<T, Box<Any:Send>> { + pub fn try<T: Send>(mut self, f: proc(): Send -> T) + -> Result<T, Box<Any + Send>> { let (tx, rx) = channel(); let result = self.future_result(); @@ -247,7 +247,7 @@ impl TaskOpts { /// the provided unique closure. /// /// This function is equivalent to `TaskBuilder::new().spawn(f)`. -pub fn spawn(f: proc():Send) { +pub fn spawn(f: proc(): Send) { TaskBuilder::new().spawn(f) } @@ -255,7 +255,7 @@ pub fn spawn(f: proc():Send) { /// the function or an error if the task failed /// /// This is equivalent to TaskBuilder::new().try -pub fn try<T:Send>(f: proc():Send -> T) -> Result<T, Box<Any:Send>> { +pub fn try<T: Send>(f: proc(): Send -> T) -> Result<T, Box<Any + Send>> { TaskBuilder::new().try(f) } @@ -344,7 +344,7 @@ fn test_run_basic() { fn test_with_wrapper() { let (tx, rx) = channel(); TaskBuilder::new().with_wrapper(proc(body) { - let result: proc():Send = proc() { + let result: proc(): Send = proc() { body(); tx.send(()); }; @@ -430,7 +430,7 @@ fn test_spawn_sched_childs_on_default_sched() { } #[cfg(test)] -fn avoid_copying_the_body(spawnfn: |v: proc():Send|) { +fn avoid_copying_the_body(spawnfn: |v: proc(): Send|) { let (tx, rx) = channel::<uint>(); let x = box 1; @@ -476,7 +476,7 @@ fn test_child_doesnt_ref_parent() { // (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) -> proc():Send { + fn child_no(x: uint) -> proc(): Send { return proc() { if x < generations { TaskBuilder::new().spawn(child_no(x+1)); @@ -522,10 +522,10 @@ fn test_try_fail_message_owned_str() { #[test] fn test_try_fail_message_any() { match try(proc() { - fail!(box 413u16 as Box<Any:Send>); + fail!(box 413u16 as Box<Any + Send>); }) { Err(e) => { - type T = Box<Any:Send>; + type T = Box<Any + Send>; assert!(e.is::<T>()); let any = e.move::<T>().unwrap(); assert!(any.is::<u16>()); |
