From 5b9f76eb7c53a28ed99d4005645485e24568ce22 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 14 Nov 2011 13:49:56 -0800 Subject: stdlib: Run cleanups on data that fails to send --- src/rt/rust_builtin.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/rt/rust_builtin.cpp') diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index db9704b540b..da7280211fd 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -485,10 +485,11 @@ get_port_id(rust_port *port) { return port->id; } -extern "C" CDECL void +extern "C" CDECL uintptr_t chan_id_send(type_desc *t, rust_task_id target_task_id, rust_port_id target_port_id, void *sptr) { // FIXME: make sure this is thread-safe + bool sent = false; rust_task *task = rust_scheduler::get_task(); rust_task *target_task = task->kernel->get_task_by_id(target_task_id); if(target_task) { @@ -497,9 +498,11 @@ chan_id_send(type_desc *t, rust_task_id target_task_id, port->send(sptr); scoped_lock with(target_task->lock); port->deref(); + sent = true; } target_task->deref(); } + return (uintptr_t)sent; } // This is called by an intrinsic on the Rust stack. -- cgit 1.4.1-3-g733a5