about summary refs log tree commit diff
path: root/src/rt/rust_builtin.cpp
diff options
context:
space:
mode:
authorEric Holk <eholk@mozilla.com>2011-06-22 15:44:47 -0700
committerGraydon Hoare <graydon@mozilla.com>2011-06-27 09:58:39 -0700
commit681c063ec02ce9fc6bdcd99b0b73f016a9839d59 (patch)
tree24f775ba4dda57790e7c8ecb5cf9abdfc4209ee8 /src/rt/rust_builtin.cpp
parent6367bcf4276c06d41b0d66f10711ca3b076ae547 (diff)
downloadrust-681c063ec02ce9fc6bdcd99b0b73f016a9839d59.tar.gz
rust-681c063ec02ce9fc6bdcd99b0b73f016a9839d59.zip
Conservatively serialize nearly all upcalls. Successfuly ran make check with RUST_THREADS=8, so we're probably fairly safe now. In the future we can relax the synchronization to get better performance.
Diffstat (limited to 'src/rt/rust_builtin.cpp')
-rw-r--r--src/rt/rust_builtin.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index 74b1075f701..27fe45e42d7 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -391,12 +391,17 @@ task_yield(rust_task *task) {
 
 extern "C" CDECL void
 task_join(rust_task *task, rust_task *join_task) {
+    task->dom->scheduler_lock.lock();
     // If the other task is already dying, we don't have to wait for it.
     if (join_task->dead() == false) {
         join_task->tasks_waiting_to_join.push(task);
         task->block(join_task, "joining local task");
+        task->dom->scheduler_lock.unlock();
         task->yield(2);
     }
+    else {
+        task->dom->scheduler_lock.unlock();
+    }
 }
 
 /* Debug builtins for std.dbg. */