about summary refs log tree commit diff
path: root/src/rt/rust_builtin.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-11-14 13:49:56 -0800
committerBrian Anderson <banderson@mozilla.com>2011-11-14 14:07:52 -0800
commit5b9f76eb7c53a28ed99d4005645485e24568ce22 (patch)
treee2b0c93a60fe8e96ca948e6108029cf5a0605eeb /src/rt/rust_builtin.cpp
parentc74fd1dc772ca67ec4d885152f01e33acad9213c (diff)
downloadrust-5b9f76eb7c53a28ed99d4005645485e24568ce22.tar.gz
rust-5b9f76eb7c53a28ed99d4005645485e24568ce22.zip
stdlib: Run cleanups on data that fails to send
Diffstat (limited to 'src/rt/rust_builtin.cpp')
-rw-r--r--src/rt/rust_builtin.cpp5
1 files changed, 4 insertions, 1 deletions
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.