diff options
| author | Ben Blum <bblum@andrew.cmu.edu> | 2013-07-16 13:42:12 -0400 |
|---|---|---|
| committer | Ben Blum <bblum@andrew.cmu.edu> | 2013-07-20 05:12:04 -0400 |
| commit | 21831458500b1a5c78fe6aeccab5412fac701d9f (patch) | |
| tree | 01b2cc22e1b90e4d93c8e038eb420bec44311e0a /src/libstd | |
| parent | f3c79c4026740ea2db0065ae14339d6586918a47 (diff) | |
| download | rust-21831458500b1a5c78fe6aeccab5412fac701d9f.tar.gz rust-21831458500b1a5c78fe6aeccab5412fac701d9f.zip | |
Rename TCB to Taskgroup
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/rt/task.rs | 4 | ||||
| -rw-r--r-- | src/libstd/task/spawn.rs | 27 |
2 files changed, 16 insertions, 15 deletions
diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs index f6e2faf5bf1..d2975148350 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -27,7 +27,7 @@ use super::local_heap::LocalHeap; use rt::sched::{Scheduler, SchedHandle}; use rt::stack::{StackSegment, StackPool}; use rt::context::Context; -use task::spawn::TCB; +use task::spawn::Taskgroup; use cell::Cell; pub struct Task { @@ -37,7 +37,7 @@ pub struct Task { logger: StdErrLogger, unwinder: Unwinder, home: Option<SchedHome>, - taskgroup: Option<TCB>, + taskgroup: Option<Taskgroup>, death: Death, destroyed: bool, coroutine: Option<~Coroutine> diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs index b099985b1ac..9734a41ba3b 100644 --- a/src/libstd/task/spawn.rs +++ b/src/libstd/task/spawn.rs @@ -338,7 +338,7 @@ fn each_ancestor(list: &mut AncestorList, } // One of these per task. -pub struct TCB { +pub struct Taskgroup { // List of tasks with whose fates this one's is intertwined. tasks: TaskGroupArc, // 'none' means the group has failed. // Lists of tasks who will kill us if they fail, but whom we won't kill. @@ -347,12 +347,12 @@ pub struct TCB { notifier: Option<AutoNotify>, } -impl Drop for TCB { +impl Drop for Taskgroup { // Runs on task exit. fn drop(&self) { unsafe { // FIXME(#4330) Need self by value to get mutability. - let this: &mut TCB = transmute(self); + let this: &mut Taskgroup = transmute(self); // If we are failing, the whole taskgroup needs to die. do RuntimeGlue::with_task_handle_and_failing |me, failing| { @@ -382,15 +382,15 @@ impl Drop for TCB { } } -pub fn TCB(tasks: TaskGroupArc, +pub fn Taskgroup(tasks: TaskGroupArc, ancestors: AncestorList, is_main: bool, - mut notifier: Option<AutoNotify>) -> TCB { + mut notifier: Option<AutoNotify>) -> Taskgroup { for notifier.mut_iter().advance |x| { x.failed = false; } - TCB { + Taskgroup { tasks: tasks, ancestors: ancestors, is_main: is_main, @@ -488,11 +488,11 @@ fn kill_taskgroup(state: TaskGroupInner, me: &TaskHandle, is_main: bool) { // FIXME (#2912): Work around core-vs-coretest function duplication. Can't use // a proper closure because the #[test]s won't understand. Have to fake it. #[cfg(not(stage0))] -fn taskgroup_key() -> local_data::Key<@@mut TCB> { +fn taskgroup_key() -> local_data::Key<@@mut Taskgroup> { unsafe { cast::transmute(-2) } } #[cfg(stage0)] -fn taskgroup_key() -> local_data::Key<@@mut TCB> { +fn taskgroup_key() -> local_data::Key<@@mut Taskgroup> { unsafe { cast::transmute((-2, 0)) } } @@ -540,7 +540,7 @@ impl RuntimeGlue { } } - fn with_my_taskgroup<U>(blk: &fn(&TCB) -> U) -> U { + fn with_my_taskgroup<U>(blk: &fn(&Taskgroup) -> U) -> U { match context() { OldTaskContext => unsafe { let me = rt::rust_get_task(); @@ -555,7 +555,8 @@ impl RuntimeGlue { descendants: TaskSet::new(), })); // Main task/group has no ancestors, no notifier, etc. - let group = @@mut TCB(tasks, AncestorList(None), true, None); + let group = @@mut Taskgroup(tasks, AncestorList(None), + true, None); local_set(OldHandle(me), taskgroup_key(), group); blk(&**group) } @@ -577,7 +578,7 @@ impl RuntimeGlue { members: members, descendants: TaskSet::new(), })); - let group = TCB(tasks, AncestorList(None), true, None); + let group = Taskgroup(tasks, AncestorList(None), true, None); (*me).taskgroup = Some(group); (*me).taskgroup.get_ref() } @@ -683,7 +684,7 @@ fn spawn_raw_newsched(mut opts: TaskOpts, f: ~fn()) { if enlist_many(NewTask(handle), &child_tg, &mut ancestors) { // Got in. We can run the provided child body, and can also run // the taskgroup's exit-time-destructor afterward. - me.taskgroup = Some(TCB(child_tg, ancestors, is_main, None)); + me.taskgroup = Some(Taskgroup(child_tg, ancestors, is_main, None)); true } else { false @@ -781,7 +782,7 @@ fn spawn_raw_oldsched(mut opts: TaskOpts, f: ~fn()) { let notifier = notify_chan.map_consume(|c| AutoNotify(c)); if enlist_many(OldTask(child), &child_arc, &mut ancestors) { - let group = @@mut TCB(child_arc, ancestors, is_main, notifier); + let group = @@mut Taskgroup(child_arc, ancestors, is_main, notifier); unsafe { local_set(OldHandle(child), taskgroup_key(), group); } |
