diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-11-20 14:17:12 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-11-26 08:23:57 -0800 |
| commit | 1eca34de7dd55719cd83153994e5caf2027f62a2 (patch) | |
| tree | 14ba2903a9ead6e569d08a33c9ebfc2c6ba07e9e /src/libstd/rt/task.rs | |
| parent | 6801bc8f552ce740deb60212903ba43de197689c (diff) | |
| download | rust-1eca34de7dd55719cd83153994e5caf2027f62a2.tar.gz rust-1eca34de7dd55719cd83153994e5caf2027f62a2.zip | |
libstd: Remove all non-`proc` uses of `do` from libstd
Diffstat (limited to 'src/libstd/rt/task.rs')
| -rw-r--r-- | src/libstd/rt/task.rs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs index bc9496b16cd..569d96ae388 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -142,7 +142,7 @@ impl Task { -> ~Task { let f = Cell::new(f); let home = Cell::new(home); - do Local::borrow |running_task: &mut Task| { + Local::borrow(|running_task: &mut Task| { let mut sched = running_task.sched.take_unwrap(); let new_task = ~running_task.new_child_homed(&mut sched.stack_pool, stack_size, @@ -150,7 +150,7 @@ impl Task { f.take()); running_task.sched = Some(sched); new_task - } + }) } pub fn build_child(stack_size: Option<uint>, f: proc()) -> ~Task { @@ -163,7 +163,7 @@ impl Task { -> ~Task { let f = Cell::new(f); let home = Cell::new(home); - do Local::borrow |running_task: &mut Task| { + Local::borrow(|running_task: &mut Task| { let mut sched = running_task.sched.take_unwrap(); let new_task = ~Task::new_root_homed(&mut sched.stack_pool, stack_size, @@ -171,7 +171,7 @@ impl Task { f.take()); running_task.sched = Some(sched); new_task - } + }) } pub fn build_root(stack_size: Option<uint>, f: proc()) -> ~Task { @@ -280,10 +280,10 @@ impl Task { // The only try/catch block in the world. Attempt to run the task's // client-specified code and catch any failures. - do self.unwinder.try { + self.unwinder.try(|| { // Run the task main function, then do some cleanup. - do f.finally { + f.finally(|| { // First, destroy task-local storage. This may run user dtors. // @@ -320,8 +320,8 @@ impl Task { None => {} } self.logger.take(); - } - } + }) + }); // Cleanup the dynamic borrowck debugging info borrowck::clear_task_borrow_list(); @@ -364,7 +364,7 @@ impl Task { // Grab both the scheduler and the task from TLS and check if the // task is executing on an appropriate scheduler. pub fn on_appropriate_sched() -> bool { - do Local::borrow |task: &mut Task| { + Local::borrow(|task: &mut Task| { let sched_id = task.sched.get_ref().sched_id(); let sched_run_anything = task.sched.get_ref().run_anything; match task.task_type { @@ -383,7 +383,7 @@ impl Task { rtabort!("type error: expected: GreenTask, found: SchedTask"); } } - } + }) } } @@ -431,9 +431,9 @@ impl Coroutine { unsafe { // Again - might work while safe, or it might not. - do Local::borrow |sched: &mut Scheduler| { + Local::borrow(|sched: &mut Scheduler| { sched.run_cleanup_job(); - } + }); // To call the run method on a task we need a direct // reference to it. The task is in TLS, so we can @@ -442,7 +442,7 @@ impl Coroutine { // need to unsafe_borrow. let task: *mut Task = Local::unsafe_borrow(); - do (*task).run { + (*task).run(|| { // N.B. Removing `start` from the start wrapper // closure by emptying a cell is critical for // correctness. The ~Task pointer, and in turn the @@ -455,7 +455,7 @@ impl Coroutine { // scope while the task is still running. let start = start_cell.take(); start(); - }; + }); } // We remove the sched from the Task in TLS right now. @@ -584,7 +584,7 @@ pub extern "C" fn rust_stack_exhausted() { // #2361 - possible implementation of not using landing pads if in_green_task_context() { - do Local::borrow |task: &mut Task| { + Local::borrow(|task: &mut Task| { let n = task.name.as_ref().map(|n| n.as_slice()).unwrap_or("<unnamed>"); // See the message below for why this is not emitted to the @@ -593,7 +593,7 @@ pub extern "C" fn rust_stack_exhausted() { // call would happen to initialized it (calling out to libuv), // and the FFI call needs 2MB of stack when we just ran out. rterrln!("task '{}' has overflowed its stack", n); - } + }) } else { rterrln!("stack overflow in non-task context"); } |
