diff options
| author | Michael Bebenita <[email protected]> | 2010-08-09 08:06:08 -0700 |
|---|---|---|
| committer | Michael Bebenita <[email protected]> | 2010-08-09 08:06:08 -0700 |
| commit | 5917ca35190b526b65b4d26ad0b98024ce9e0b09 (patch) | |
| tree | c4076864029ecc75fd53fd4385caba4656d80080 /src/rt/rust_dom.cpp | |
| parent | Added peek() to ptr_vec. (diff) | |
| download | rust-5917ca35190b526b65b4d26ad0b98024ce9e0b09.tar.xz rust-5917ca35190b526b65b4d26ad0b98024ce9e0b09.zip | |
Fixed deadlock in the scheduler caused by condition variables.
Diffstat (limited to 'src/rt/rust_dom.cpp')
| -rw-r--r-- | src/rt/rust_dom.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/rt/rust_dom.cpp b/src/rt/rust_dom.cpp index f0739097..b66fca82 100644 --- a/src/rt/rust_dom.cpp +++ b/src/rt/rust_dom.cpp @@ -262,8 +262,6 @@ void rust_dom::send_message(rust_message *message) { this); A(this, message->dom == this, "Message owned by non-local domain."); _incoming_message_queue.enqueue(message); - _incoming_message_pending.signal(); - _progress.signal(); } /** @@ -398,9 +396,11 @@ rust_dom::start_main_loop() "all tasks are blocked, waiting for progress ..."); if (_log.is_tracing(rust_log::TASK)) log_state(); - _progress.wait(); log(rust_log::TASK, - "progress made, resuming ..."); + "all tasks are blocked, scheduler yielding ..."); + sync::yield(); + log(rust_log::TASK, + "scheduler resuming ..."); continue; } @@ -450,7 +450,14 @@ rust_dom::start_main_loop() } if (_incoming_message_queue.is_empty()) { - _incoming_message_pending.wait(); + log(rust_log::DOM, + "waiting for %d dead tasks to become dereferenced, " + "scheduler yielding ...", + dead_tasks.length()); + if (_log.is_tracing(rust_log::TASK)) { + log_state(); + } + sync::yield(); } else { drain_incoming_message_queue(); } |