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.

This commit is contained in:
Eric Holk
2011-06-22 15:44:47 -07:00
committed by Graydon Hoare
parent 6367bcf427
commit 681c063ec0
7 changed files with 80 additions and 42 deletions

View File

@@ -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. */