about summary refs log tree commit diff
path: root/src/rt/rust_upcall.cpp
diff options
context:
space:
mode:
authorEric Holk <eholk@mozilla.com>2011-07-27 12:29:38 -0700
committerEric Holk <eholk@mozilla.com>2011-07-28 10:47:28 -0700
commita5fe66e7065c0e91064f3a818ea901ecfb499b70 (patch)
tree52d5186c3ddbc4af42c3db3218cbaac909a75e6c /src/rt/rust_upcall.cpp
parent5302cde188bba80dd38c58eaafa792d621b0818c (diff)
downloadrust-a5fe66e7065c0e91064f3a818ea901ecfb499b70.tar.gz
rust-a5fe66e7065c0e91064f3a818ea901ecfb499b70.zip
Adding upcalls to to ref() and deref() tasks. This is the first step towards atomic reference counting of tasks.
Diffstat (limited to 'src/rt/rust_upcall.cpp')
-rw-r--r--src/rt/rust_upcall.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp
index 3415b6b62ae..103aa49a6e9 100644
--- a/src/rt/rust_upcall.cpp
+++ b/src/rt/rust_upcall.cpp
@@ -547,6 +547,23 @@ upcall_new_task(rust_task *spawner, rust_vec *name) {
     return task;
 }
 
+extern "C" CDECL void
+upcall_take_task(rust_task *task, rust_task *target) {
+    LOG_UPCALL_ENTRY(task);
+    if(target) {
+        target->ref();
+    }
+}
+
+extern "C" CDECL void
+upcall_drop_task(rust_task *task, rust_task *target) {
+    LOG_UPCALL_ENTRY(task);
+    if(target) {
+        //target->deref();
+        --target->ref_count;
+    }
+}
+
 extern "C" CDECL rust_task *
 upcall_start_task(rust_task *spawner,
                   rust_task *task,