Skip to content

Commit f8de679

Browse files
nikomatsakisbrson
authored andcommitted
move remaining task natives to cdecl ABI (run on rust stack)
1 parent e838edc commit f8de679

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/lib/task.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,27 @@ export spawn;
2222
export spawn_notify;
2323
export spawn_joinable;
2424

25-
native "rust" mod rustrt { // C Stack?
26-
fn task_sleep(time_in_us: uint); // No
27-
fn task_yield(); // No
28-
fn start_task(id: task_id, closure: *u8); // No
29-
fn task_join(t: task_id) -> int; // Refactor
25+
native "cdecl" mod rustrt {
26+
// these must run on the Rust stack so that they can swap stacks etc:
27+
fn task_sleep(time_in_us: uint);
28+
fn task_yield();
29+
fn start_task(id: task_id, closure: *u8);
30+
fn task_join(t: task_id) -> int;
3031
}
3132

3233
native "c-stack-cdecl" mod rustrt2 = "rustrt" {
33-
fn pin_task(); // Yes
34-
fn unpin_task(); // Yes
35-
fn get_task_id() -> task_id; // Yes
34+
// these can run on the C stack:
35+
fn pin_task();
36+
fn unpin_task();
37+
fn get_task_id() -> task_id;
3638

37-
fn set_min_stack(stack_size: uint); // Yes
39+
fn set_min_stack(stack_size: uint);
3840

3941
fn new_task() -> task_id;
4042
fn drop_task(task: *rust_task);
4143
fn get_task_pointer(id: task_id) -> *rust_task;
4244

43-
fn migrate_alloc(alloc: *u8, target: task_id); // Yes
45+
fn migrate_alloc(alloc: *u8, target: task_id);
4446
}
4547

4648
type rust_task =

0 commit comments

Comments
 (0)