From ae2968d10a87b0f467b25ccde2e2a2eb3741e017 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 8 Feb 2012 16:23:17 -0800 Subject: [PATCH] core: Use rust_task_config_notify instead of twiddling rust_task's innards --- src/libcore/task.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 637a684b8d8f..ad1f4a7fc7a7 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -72,8 +72,8 @@ native mod rustrt { fn new_task() -> task_id; fn rust_new_task_in_sched(id: sched_id) -> task_id; - fn drop_task(task_id: *rust_task); - fn get_task_pointer(id: task_id) -> *rust_task; + fn rust_task_config_notify( + id: task_id, &&chan: comm::chan); fn start_task(id: task, closure: *rust_closure); @@ -83,13 +83,7 @@ native mod rustrt { /* Section: Types */ -type rust_task = - {id: task, - mutable notify_enabled: int, - mutable notify_chan: comm::chan, - mutable stack_ptr: *u8}; - -resource rust_task_ptr(task: *rust_task) { rustrt::drop_task(task); } +type rust_task = *ctypes::void; type sched_id = int; type task_id = int; @@ -132,9 +126,7 @@ fn spawn_inner( // set up notifications if they are enabled. option::may(notify) {|c| - let task_ptr <- rust_task_ptr(rustrt::get_task_pointer(id)); - (**task_ptr).notify_enabled = 1; - (**task_ptr).notify_chan = c; + rustrt::rust_task_config_notify(id, c); } rustrt::start_task(id, closure);