Skip to content

Commit ae2968d

Browse files
committed
core: Use rust_task_config_notify instead of twiddling rust_task's innards
1 parent d756b01 commit ae2968d

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/libcore/task.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ native mod rustrt {
7272
fn new_task() -> task_id;
7373
fn rust_new_task_in_sched(id: sched_id) -> task_id;
7474

75-
fn drop_task(task_id: *rust_task);
76-
fn get_task_pointer(id: task_id) -> *rust_task;
75+
fn rust_task_config_notify(
76+
id: task_id, &&chan: comm::chan<task_notification>);
7777

7878
fn start_task(id: task, closure: *rust_closure);
7979

@@ -83,13 +83,7 @@ native mod rustrt {
8383

8484
/* Section: Types */
8585

86-
type rust_task =
87-
{id: task,
88-
mutable notify_enabled: int,
89-
mutable notify_chan: comm::chan<task_notification>,
90-
mutable stack_ptr: *u8};
91-
92-
resource rust_task_ptr(task: *rust_task) { rustrt::drop_task(task); }
86+
type rust_task = *ctypes::void;
9387

9488
type sched_id = int;
9589
type task_id = int;
@@ -132,9 +126,7 @@ fn spawn_inner(
132126

133127
// set up notifications if they are enabled.
134128
option::may(notify) {|c|
135-
let task_ptr <- rust_task_ptr(rustrt::get_task_pointer(id));
136-
(**task_ptr).notify_enabled = 1;
137-
(**task_ptr).notify_chan = c;
129+
rustrt::rust_task_config_notify(id, c);
138130
}
139131

140132
rustrt::start_task(id, closure);

0 commit comments

Comments
 (0)