From 2f8b69534435d8dc459e5731d8fb41b22725b37f Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Tue, 8 Nov 2011 14:05:23 -0800 Subject: [PATCH] start_task can run on the C stack --- src/lib/task.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/task.rs b/src/lib/task.rs index 304cf59f81d..b8983e97c8b 100644 --- a/src/lib/task.rs +++ b/src/lib/task.rs @@ -54,7 +54,6 @@ native "cdecl" mod rustrt { // these must run on the Rust stack so that they can swap stacks etc: fn task_sleep(time_in_us: uint); fn task_yield(); - fn start_task(id: task, closure: *u8); } native "c-stack-cdecl" mod rustrt2 = "rustrt" { @@ -70,6 +69,9 @@ native "c-stack-cdecl" mod rustrt2 = "rustrt" { fn get_task_pointer(id: task_id) -> *rust_task; fn migrate_alloc(alloc: *u8, target: task_id); + + fn start_task(id: task, closure: *u8); + } /* Section: Types */ @@ -322,7 +324,7 @@ fn unsafe_spawn_inner(-thunk: fn@(), // give the thunk environment's allocation to the new task rustrt2::migrate_alloc(cast(raw_thunk.env), id); - rustrt::start_task(id, cast(thunkfn)); + rustrt2::start_task(id, cast(thunkfn)); // don't cleanup the thunk in this task unsafe::leak(thunk); ret id;