diff options
| author | Eric Holk <eholk@mozilla.com> | 2011-07-27 12:29:38 -0700 |
|---|---|---|
| committer | Eric Holk <eholk@mozilla.com> | 2011-07-28 10:47:28 -0700 |
| commit | a5fe66e7065c0e91064f3a818ea901ecfb499b70 (patch) | |
| tree | 52d5186c3ddbc4af42c3db3218cbaac909a75e6c /src/rt | |
| parent | 5302cde188bba80dd38c58eaafa792d621b0818c (diff) | |
| download | rust-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')
| -rw-r--r-- | src/rt/rust_upcall.cpp | 17 | ||||
| -rw-r--r-- | src/rt/rustrt.def.in | 2 | ||||
| -rw-r--r-- | src/rt/sync/lock_and_signal.cpp | 2 |
3 files changed, 20 insertions, 1 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, diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index 8326cabea88..d6c218d936d 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -59,6 +59,7 @@ upcall_chan_target_task upcall_clone_chan upcall_del_chan upcall_del_port +upcall_drop_task upcall_dup_str upcall_exit upcall_fail @@ -87,6 +88,7 @@ upcall_shared_malloc upcall_shared_free upcall_sleep upcall_start_task +upcall_take_task upcall_trace_str upcall_trace_word upcall_vec_append diff --git a/src/rt/sync/lock_and_signal.cpp b/src/rt/sync/lock_and_signal.cpp index f4c3778837d..67f6b107b3a 100644 --- a/src/rt/sync/lock_and_signal.cpp +++ b/src/rt/sync/lock_and_signal.cpp @@ -10,7 +10,7 @@ #include "lock_and_signal.h" #if defined(__WIN32__) -lock_and_signal::lock_and_signal() +lock_and_signal::lock_and_signal() : alive(true) { // FIXME: In order to match the behavior of pthread_cond_broadcast on |
