diff options
| author | bors <bors@rust-lang.org> | 2013-11-19 13:31:19 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-11-19 13:31:19 -0800 |
| commit | c159acb05d95d832de3cebb5e1e91ee34e550c9d (patch) | |
| tree | 5663e1c00b8b8a4aad67b706807900f43a2ea600 /src/libstd/task | |
| parent | eef913b290f668b4f131ead5be65a1615616426b (diff) | |
| parent | 7e3f20133a0f38e4f18dce9992d1b4c13215f91f (diff) | |
| download | rust-c159acb05d95d832de3cebb5e1e91ee34e550c9d.tar.gz rust-c159acb05d95d832de3cebb5e1e91ee34e550c9d.zip | |
auto merge of #10568 : pcwalton/rust/more-bars, r=alexcrichton
r? @alexcrichton
Diffstat (limited to 'src/libstd/task')
| -rw-r--r-- | src/libstd/task/mod.rs | 8 | ||||
| -rw-r--r-- | src/libstd/task/spawn.rs | 28 |
2 files changed, 19 insertions, 17 deletions
diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs index 5915dd45c08..f9b918d6d12 100644 --- a/src/libstd/task/mod.rs +++ b/src/libstd/task/mod.rs @@ -554,7 +554,7 @@ pub fn try<T:Send>(f: proc() -> T) -> Result<T, ~Any> { /* Lifecycle functions */ /// Read the name of the current task. -pub fn with_task_name<U>(blk: &fn(Option<&str>) -> U) -> U { +pub fn with_task_name<U>(blk: |Option<&str>| -> U) -> U { use rt::task::Task; if in_green_task_context() { @@ -605,7 +605,7 @@ pub fn failing() -> bool { * } * ``` */ -pub fn unkillable<U>(f: &fn() -> U) -> U { +pub fn unkillable<U>(f: || -> U) -> U { use rt::task::Task; unsafe { @@ -640,7 +640,7 @@ pub fn unkillable<U>(f: &fn() -> U) -> U { * // Task is unkillable again * } */ -pub fn rekillable<U>(f: &fn() -> U) -> U { +pub fn rekillable<U>(f: || -> U) -> U { use rt::task::Task; unsafe { @@ -1201,7 +1201,7 @@ fn test_spawn_sched_blocking() { } #[cfg(test)] -fn avoid_copying_the_body(spawnfn: &fn(v: proc())) { +fn avoid_copying_the_body(spawnfn: |v: proc()|) { let (p, ch) = stream::<uint>(); let x = ~1; diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs index d7d3e715ef9..66a2e8cc5e0 100644 --- a/src/libstd/task/spawn.rs +++ b/src/libstd/task/spawn.rs @@ -164,15 +164,17 @@ struct AncestorList(Option<Exclusive<AncestorNode>>); // Accessors for taskgroup arcs and ancestor arcs that wrap the unsafety. #[inline] -fn access_group<U>(x: &TaskGroupArc, blk: &fn(TaskGroupInner) -> U) -> U { +fn access_group<U>(x: &TaskGroupArc, blk: |TaskGroupInner| -> U) -> U { unsafe { x.with(blk) } } #[inline] -fn access_ancestors<U>(x: &Exclusive<AncestorNode>, - blk: &fn(x: &mut AncestorNode) -> U) -> U { +fn access_ancestors<U>( + x: &Exclusive<AncestorNode>, + blk: |x: &mut AncestorNode| -> U) + -> U { unsafe { x.with(blk) } @@ -197,17 +199,17 @@ fn incr_generation(_ancestors: &AncestorList) -> uint { 0 } // is NOT called on the block that forward_blk broke on!). // (3) As a bonus, coalesces away all 'dead' taskgroup nodes in the list. fn each_ancestor(list: &mut AncestorList, - bail_blk: &fn(TaskGroupInner), - forward_blk: &fn(TaskGroupInner) -> bool) - -> bool { + bail_blk: |TaskGroupInner|, + forward_blk: |TaskGroupInner| -> bool) + -> bool { // "Kickoff" call - there was no last generation. return !coalesce(list, bail_blk, forward_blk, uint::max_value); // Recursively iterates, and coalesces afterwards if needed. Returns // whether or not unwinding is needed (i.e., !successful iteration). fn coalesce(list: &mut AncestorList, - bail_blk: &fn(TaskGroupInner), - forward_blk: &fn(TaskGroupInner) -> bool, + bail_blk: |TaskGroupInner|, + forward_blk: |TaskGroupInner| -> bool, last_generation: uint) -> bool { let (coalesce_this, early_break) = iterate(list, bail_blk, forward_blk, last_generation); @@ -229,8 +231,8 @@ fn each_ancestor(list: &mut AncestorList, // True if the supplied block did 'break', here or in any recursive // calls. If so, must call the unwinder on all previous nodes. fn iterate(ancestors: &mut AncestorList, - bail_blk: &fn(TaskGroupInner), - forward_blk: &fn(TaskGroupInner) -> bool, + bail_blk: |TaskGroupInner|, + forward_blk: |TaskGroupInner| -> bool, last_generation: uint) -> (Option<AncestorList>, bool) { // At each step of iteration, three booleans are at play which govern @@ -457,7 +459,7 @@ impl RuntimeGlue { }; } - fn with_task_handle_and_failing(blk: &fn(&KillHandle, bool)) { + fn with_task_handle_and_failing(blk: |&KillHandle, bool|) { assert!(in_green_task_context()); unsafe { // Can't use safe borrow, because the taskgroup destructor needs to @@ -467,7 +469,7 @@ impl RuntimeGlue { } } - fn with_my_taskgroup<U>(blk: &fn(&Taskgroup) -> U) -> U { + fn with_my_taskgroup<U>(blk: |&Taskgroup| -> U) -> U { assert!(in_green_task_context()); unsafe { // Can't use safe borrow, because creating new hashmaps for the @@ -545,7 +547,7 @@ fn enlist_many(child: &KillHandle, child_arc: &TaskGroupArc, }; if result { // Unwinding function in case any ancestral enlisting fails - let bail: &fn(TaskGroupInner) = |tg| { leave_taskgroup(tg, child, false) }; + let bail: |TaskGroupInner| = |tg| { leave_taskgroup(tg, child, false) }; // Attempt to join every ancestor group. result = do each_ancestor(ancestors, bail) |ancestor_tg| { // Enlist as a descendant, not as an actual member. |
