Skip to content

Commit 4174de8

Browse files
committed
rt: expose rust_task refcounts to rustland
1 parent f57760c commit 4174de8

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/rt/rust_builtin.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,18 @@ task_signal_event(rust_task *target, void *event) {
968968
target->signal_event(event);
969969
}
970970

971+
// Can safely run on the rust stack.
972+
extern "C" void
973+
rust_task_ref(rust_task *task) {
974+
task->ref();
975+
}
976+
977+
// Don't run on the rust stack!
978+
extern "C" void
979+
rust_task_deref(rust_task *task) {
980+
task->deref();
981+
}
982+
971983
//
972984
// Local Variables:
973985
// mode: C++

src/rt/rustrt.def.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,5 @@ rust_signal_cond_lock
194194
rust_get_task_local_data
195195
rust_set_task_local_data
196196
rust_task_local_data_atexit
197+
rust_task_ref
198+
rust_task_deref

0 commit comments

Comments
 (0)