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-18 14:45:48 -0800
committerBrian Anderson <banderson@mozilla.com>2011-11-18 14:45:48 -0800
commit792068d871f2a8f7184a6f109db1d65c73bf63da (patch)
tree4250b4b01f7837ef34f05d9be8c53e89533f82f6 /src/rt/rust_builtin.cpp
parent0f339b481a8ae255f012f2218c8f5b5fc3d451ce (diff)
downloadrust-792068d871f2a8f7184a6f109db1d65c73bf63da.tar.gz
rust-792068d871f2a8f7184a6f109db1d65c73bf63da.zip
rt: Remove unblock call from rust_task::yield
Diffstat (limited to 'src/rt/rust_builtin.cpp')
-rw-r--r--src/rt/rust_builtin.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index 3460d460900..ff83cb7ec6b 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -516,7 +516,10 @@ rust_task_sleep(rust_task *task, size_t time_in_us) {
 }
 
 extern "C" CDECL void
-port_recv(uintptr_t *dptr, rust_port *port, uintptr_t *yield) {
+port_recv(uintptr_t *dptr, rust_port *port,
+          uintptr_t *yield, uintptr_t *killed) {
+    *yield = false;
+    *killed = false;
     rust_task *task = rust_scheduler::get_task();
     {
         scoped_lock with(port->lock);
@@ -526,7 +529,13 @@ port_recv(uintptr_t *dptr, rust_port *port, uintptr_t *yield) {
             (uintptr_t) port, (uintptr_t) dptr, port->unit_sz);
 
         if (port->receive(dptr)) {
-            *yield = false;
+            return;
+        }
+
+        // If this task has been killed then we're not going to bother
+        // blocking, we have to unwind.
+        if (task->killed) {
+            *killed = true;
             return;
         }