From 2e6dc161b6efac1ce2709ab4e1c05c55c01e3abf Mon Sep 17 00:00:00 2001 From: Ben Blum Date: Tue, 30 Jul 2013 19:20:59 -0400 Subject: Give tasks useful names. #2891 --- src/libstd/rt/mod.rs | 2 ++ src/libstd/rt/task.rs | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src/libstd/rt') diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index dc8669b9264..c38b929a6ce 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -316,12 +316,14 @@ fn run_(main: ~fn(), use_main_sched: bool) -> int { // Just put an unpinned task onto one of the default schedulers. let mut main_task = ~Task::new_root(&mut scheds[0].stack_pool, main); main_task.death.on_exit = Some(on_exit); + main_task.name = Some(~"main"); scheds[0].enqueue_task(main_task); } Some(ref mut main_sched) => { let home = Sched(main_sched.make_handle()); let mut main_task = ~Task::new_root_homed(&mut scheds[0].stack_pool, home, main); main_task.death.on_exit = Some(on_exit); + main_task.name = Some(~"main"); main_sched.enqueue_task(main_task); } }; diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs index 82d4f8fcc04..c1b799796d1 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -40,7 +40,9 @@ pub struct Task { taskgroup: Option, death: Death, destroyed: bool, - coroutine: Option<~Coroutine> + coroutine: Option<~Coroutine>, + // FIXME(#6874/#7599) use StringRef to save on allocations + name: Option<~str>, } pub struct Coroutine { @@ -90,7 +92,8 @@ impl Task { taskgroup: None, death: Death::new(), destroyed: false, - coroutine: Some(~Coroutine::new(stack_pool, start)) + coroutine: Some(~Coroutine::new(stack_pool, start)), + name: None, } } @@ -109,7 +112,8 @@ impl Task { // FIXME(#7544) make watching optional death: self.death.new_child(), destroyed: false, - coroutine: Some(~Coroutine::new(stack_pool, start)) + coroutine: Some(~Coroutine::new(stack_pool, start)), + name: None, } } -- cgit 1.4.1-3-g733a5