diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-02-08 16:23:17 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-02-09 19:00:15 -0800 |
| commit | ae2968d10a87b0f467b25ccde2e2a2eb3741e017 (patch) | |
| tree | 3238719a30034b822387796a4c1fbd6071b55bb8 | |
| parent | d756b01619444bbbaa27d1f43ca4000c976c8bee (diff) | |
| download | rust-ae2968d10a87b0f467b25ccde2e2a2eb3741e017.tar.gz rust-ae2968d10a87b0f467b25ccde2e2a2eb3741e017.zip | |
core: Use rust_task_config_notify instead of twiddling rust_task's innards
| -rw-r--r-- | src/libcore/task.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 637a684b8d8..ad1f4a7fc7a 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<task_notification>); 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<task_notification>, - 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); |
