From 4174de8bb941c3edbeb14f42ab4ebbfff5fb176d Mon Sep 17 00:00:00 2001 From: Ben Blum Date: Fri, 3 Aug 2012 21:00:23 -0400 Subject: [PATCH] rt: expose rust_task refcounts to rustland --- src/rt/rust_builtin.cpp | 12 ++++++++++++ src/rt/rustrt.def.in | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index f9c95db1d04b..1ba941c233ca 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -968,6 +968,18 @@ task_signal_event(rust_task *target, void *event) { target->signal_event(event); } +// Can safely run on the rust stack. +extern "C" void +rust_task_ref(rust_task *task) { + task->ref(); +} + +// Don't run on the rust stack! +extern "C" void +rust_task_deref(rust_task *task) { + task->deref(); +} + // // Local Variables: // mode: C++ diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index b3bc75d03c50..997dcf0e668c 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -194,3 +194,5 @@ rust_signal_cond_lock rust_get_task_local_data rust_set_task_local_data rust_task_local_data_atexit +rust_task_ref +rust_task_deref