/// 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>>,
}
/**
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,
}
* 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() {
* 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),
* # 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();
/// 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)
}
/// 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)
}
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(());
};
}
#[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;
// (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));
#[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>());