From 28256052a4b141350dc0fe4e2e5357137bb49706 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 2 May 2013 18:33:18 -0400 Subject: core: Use the new `for` protocol --- src/libcore/task/spawn.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/libcore/task') diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 19c417dfdfc..846d4a34950 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -110,9 +110,14 @@ fn taskset_remove(tasks: &mut TaskSet, task: *rust_task) { let was_present = tasks.remove(&task); assert!(was_present); } +#[cfg(stage0)] pub fn taskset_each(tasks: &TaskSet, blk: &fn(v: *rust_task) -> bool) { tasks.each(|k| blk(*k)) } +#[cfg(not(stage0))] +pub fn taskset_each(tasks: &TaskSet, blk: &fn(v: *rust_task) -> bool) -> bool { + tasks.each(|k| blk(*k)) +} // One of these per group of linked-failure tasks. struct TaskGroupData { @@ -685,13 +690,11 @@ fn spawn_raw_oldsched(mut opts: TaskOpts, f: ~fn()) { }; // Attempt to join every ancestor group. result = - for each_ancestor(ancestors, Some(bail)) |ancestor_tg| { + each_ancestor(ancestors, Some(bail), |ancestor_tg| { // Enlist as a descendant, not as an actual member. // Descendants don't kill ancestor groups on failure. - if !enlist_in_taskgroup(ancestor_tg, child, false) { - break; - } - }; + enlist_in_taskgroup(ancestor_tg, child, false) + }); // If any ancestor group fails, need to exit this group too. if !result { do access_group(child_arc) |child_tg| { -- cgit 1.4.1-3-g733a5