diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-02-08 16:22:38 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-02-09 19:00:15 -0800 |
| commit | d756b01619444bbbaa27d1f43ca4000c976c8bee (patch) | |
| tree | bb6149a6f7da26918a149880fdfab78bf7530bd7 /src/rt | |
| parent | e0d5b92b84424b5b1dbd2dec7d32e92e1550832b (diff) | |
| download | rust-d756b01619444bbbaa27d1f43ca4000c976c8bee.tar.gz rust-d756b01619444bbbaa27d1f43ca4000c976c8bee.zip | |
rt: Add a function for configuring task notification
Diffstat (limited to 'src/rt')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 10 | ||||
| -rw-r--r-- | src/rt/rust_task.cpp | 6 | ||||
| -rw-r--r-- | src/rt/rust_task.h | 2 | ||||
| -rw-r--r-- | src/rt/rustrt.def.in | 1 |
4 files changed, 19 insertions, 0 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 65e5b82f505..fb00b07bdfd 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -481,6 +481,16 @@ drop_task(rust_task *target) { } } +extern "C" CDECL void +rust_task_config_notify(rust_task_id task_id, chan_handle *chan) { + rust_task *task = rust_task_thread::get_task(); + rust_task *target = task->kernel->get_task_by_id(task_id); + A(task->thread, target != NULL, + "This function should only be called when we know the task exists"); + target->config_notify(*chan); + target->deref(); +} + extern "C" CDECL rust_task * get_task_pointer(rust_task_id id) { rust_task *task = rust_task_thread::get_task(); diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 79b3d873e88..398db5976bb 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -713,6 +713,12 @@ rust_task::check_stack_canary() { ::check_stack_canary(stk); } +void +rust_task::config_notify(chan_handle chan) { + user.notify_enabled = true; + user.notify_chan = chan; +} + // // Local Variables: // mode: C++ diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h index 1289358bf9c..bf3671409c3 100644 --- a/src/rt/rust_task.h +++ b/src/rt/rust_task.h @@ -181,6 +181,8 @@ public: void reset_stack_limit(); bool on_rust_stack(); void check_stack_canary(); + + void config_notify(chan_handle chan); }; // diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index b0acbacf4e3..6163918ab80 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -49,6 +49,7 @@ rust_env_pairs rust_task_yield rust_task_is_unwinding rust_get_task +rust_task_config_notify sched_threads shape_log_str squareroot |
