diff options
| author | Ben Blum <bblum@andrew.cmu.edu> | 2012-08-15 14:38:38 -0400 |
|---|---|---|
| committer | Ben Blum <bblum@andrew.cmu.edu> | 2012-08-15 14:38:38 -0400 |
| commit | 00ef5418d44a191b464db87b99d8034202c86c7d (patch) | |
| tree | ecc396e11ae330c558362b43da44b5c1f53bf71f /src | |
| parent | a57d3e0c152a293885f65cdf44d4b98a5e2f71cc (diff) | |
| download | rust-00ef5418d44a191b464db87b99d8034202c86c7d.tar.gz rust-00ef5418d44a191b464db87b99d8034202c86c7d.zip | |
Change TLS key type to stack closure
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/task.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 62398a6b8c9..2748b53fb54 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -1025,9 +1025,9 @@ fn kill_taskgroup(state: taskgroup_inner, me: *rust_task, 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. -unsafe fn taskgroup_key() -> local_data_key<tcb> { +macro_rules! taskgroup_key { // Use a "code pointer" value that will never be a real code pointer. - unsafe::transmute((-2 as uint, 0u)) + {} => (unsafe::transmute((-2 as uint, 0u))) } fn gen_child_taskgroup(linked: bool, supervised: bool) @@ -1036,7 +1036,8 @@ fn gen_child_taskgroup(linked: bool, supervised: bool) /*######################################################################* * Step 1. Get spawner's taskgroup info. *######################################################################*/ - let spawner_group = match unsafe { local_get(spawner, taskgroup_key()) } { + let spawner_group = match unsafe { local_get(spawner, + taskgroup_key!()) } { none => { // Main task, doing first spawn ever. Lazily initialise here. let mut members = new_taskset(); @@ -1047,7 +1048,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool) // Main task/group has no ancestors, no notifier, etc. let group = @tcb(spawner, tasks, ancestor_list(none), true, none); - unsafe { local_set(spawner, taskgroup_key(), group); } + unsafe { local_set(spawner, taskgroup_key!(), group); } group } some(group) => group @@ -1162,7 +1163,7 @@ fn spawn_raw(+opts: task_opts, +f: fn~()) { if enlist_many(child, child_arc, &mut ancestors) { let group = @tcb(child, child_arc, ancestors, is_main, notifier); - unsafe { local_set(child, taskgroup_key(), group); } + unsafe { local_set(child, taskgroup_key!(), group); } // Run the child's body. f(); // TLS cleanup code will exit the taskgroup. @@ -1261,7 +1262,7 @@ fn spawn_raw(+opts: task_opts, +f: fn~()) { * * These two cases aside, the interface is safe. */ -type local_data_key<T: owned> = fn@(+@T); +type local_data_key<T: owned> = &fn(+@T); trait local_data { } impl<T: owned> @T: local_data { } |
