diff options
| author | Michael Bebenita <[email protected]> | 2010-07-28 14:45:44 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-07-28 20:30:29 -0700 |
| commit | 5db5eb0c55ff303db96390a4bf6a5365382cc357 (patch) | |
| tree | 2d0d68e4c4ee0cb285a13f899214ca47ec14d526 /src/rt | |
| parent | Teach task_owned and dom_owned to find their dom via consistent interface. (diff) | |
| download | rust-5db5eb0c55ff303db96390a4bf6a5365382cc357.tar.xz rust-5db5eb0c55ff303db96390a4bf6a5365382cc357.zip | |
Null rust_task::cond on wakeup, add asserts and logging to block/wakeup.
Diffstat (limited to 'src/rt')
| -rw-r--r-- | src/rt/rust_task.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 6f96ac91..2bb09541 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -529,23 +529,29 @@ rust_task::transition(ptr_vec<rust_task> *src, ptr_vec<rust_task> *dst) void rust_task::block(rust_cond *on) { - I(dom, on); + log(rust_log::TASK, "Blocking on 0x%" PRIxPTR ", cond: 0x%" PRIxPTR, + (uintptr_t) on, (uintptr_t) cond); + A(dom, cond == NULL, "Cannot block an already blocked task."); + A(dom, on != NULL, "Cannot block on a NULL object."); + transition(&dom->running_tasks, &dom->blocked_tasks); - dom->log(rust_log::TASK, - "task 0x%" PRIxPTR " blocking on 0x%" PRIxPTR, - (uintptr_t)this, - (uintptr_t)on); cond = on; } void rust_task::wakeup(rust_cond *from) { + A(dom, cond != NULL, "Cannot wake up unblocked task."); + log(rust_log::TASK, "Blocked on 0x%" PRIxPTR " woken up on 0x%" PRIxPTR, + (uintptr_t) cond, (uintptr_t) from); + A(dom, cond == from, "Cannot wake up blocked task on wrong condition."); + transition(&dom->blocked_tasks, &dom->running_tasks); // TODO: Signaling every time the task is awaken is kind of silly, // do this a nicer way. dom->_progress.signal(); I(dom, cond == from); + cond = NULL; } void |