about summary refs log tree commit diff
path: root/src/rt/rust_kernel.h
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-04-06 17:03:00 -0700
committerBrian Anderson <banderson@mozilla.com>2012-04-07 19:56:41 -0700
commit01dc4a8b26d722d306a00e44a5b1ed5cf3fd24b1 (patch)
tree7bebe6c918cd108943cd8d07b0203b25256d063f /src/rt/rust_kernel.h
parenta6e748a1d9795f59f9ca954dbf1ad82d238c3990 (diff)
downloadrust-01dc4a8b26d722d306a00e44a5b1ed5cf3fd24b1.tar.gz
rust-01dc4a8b26d722d306a00e44a5b1ed5cf3fd24b1.zip
core: Add priv::weaken_task
Diffstat (limited to 'src/rt/rust_kernel.h')
-rw-r--r--src/rt/rust_kernel.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/rt/rust_kernel.h b/src/rt/rust_kernel.h
index 6a7a7070c20..1ccd423928d 100644
--- a/src/rt/rust_kernel.h
+++ b/src/rt/rust_kernel.h
@@ -63,7 +63,15 @@ class rust_kernel {
     // on the main thread
     rust_sched_driver *osmain_driver;
 
+    // An atomically updated count of the live, 'non-weak' tasks
+    uintptr_t non_weak_tasks;
+    // Protects weak_task_chans
+    lock_and_signal weak_task_lock;
+    // A list of weak tasks that need to be told when to exit
+    std::vector<rust_port_id> weak_task_chans;
+
     rust_scheduler* get_scheduler_by_id_nolock(rust_sched_id id);
+    void end_weak_tasks();
 
 public:
     struct rust_env *env;
@@ -102,6 +110,13 @@ public:
     void set_exit_status(int code);
 
     rust_sched_id osmain_sched_id() { return osmain_scheduler; }
+
+    void register_task();
+    void unregister_task();
+    void weaken_task(rust_port_id chan);
+    void unweaken_task(rust_port_id chan);
+
+    bool send_to_port(rust_port_id chan, void *sptr);
 };
 
 template <typename T> struct kernel_owned {