about summary refs log tree commit diff
path: root/src/rt/rust_port_selector.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-03-03 20:50:11 -0800
committerBrian Anderson <banderson@mozilla.com>2012-03-05 19:39:56 -0800
commit0a5603cb58bdc66ad6b6a030e4e98ebeb3c13721 (patch)
tree1092b7474081dfc2de16104edf9131e06a3b7329 /src/rt/rust_port_selector.cpp
parentcc276fe3c96965ba39b9fba3b588a1eaa3941d86 (diff)
downloadrust-0a5603cb58bdc66ad6b6a030e4e98ebeb3c13721.tar.gz
rust-0a5603cb58bdc66ad6b6a030e4e98ebeb3c13721.zip
rt: Make linked failure less prone to deadlock
Still a mess.
Diffstat (limited to 'src/rt/rust_port_selector.cpp')
-rw-r--r--src/rt/rust_port_selector.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rt/rust_port_selector.cpp b/src/rt/rust_port_selector.cpp
index 1e1b09a59c5..319b6fb579d 100644
--- a/src/rt/rust_port_selector.cpp
+++ b/src/rt/rust_port_selector.cpp
@@ -48,8 +48,14 @@ rust_port_selector::select(rust_task *task, rust_port **dptr,
         this->n_ports = n_ports;
         I(task->thread, task->rendezvous_ptr == NULL);
         task->rendezvous_ptr = (uintptr_t*)dptr;
-        *yield = true;
         task->block(this, "waiting for select rendezvous");
+
+	// Blocking the task might fail if the task has already been
+	// killed, but in the event of both failure and success the
+	// task needs to yield. On success, it yields and waits to be
+	// unblocked. On failure it yields and is then fails the task.
+
+        *yield = true;
     }
 
     for (size_t i = 0; i < locks_taken; i++) {