diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-02-02 16:47:21 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-02-02 18:10:24 -0800 |
| commit | 5c3c8d454d58b3bb4a79d36b76582f1f7761bc75 (patch) | |
| tree | 895bd975518bbb0cc64c391e992572aa47508c8e /src/rt/rust_task.cpp | |
| parent | 5449b886d34c1ddbba60986d56d6896543a6b87f (diff) | |
| download | rust-5c3c8d454d58b3bb4a79d36b76582f1f7761bc75.tar.gz rust-5c3c8d454d58b3bb4a79d36b76582f1f7761bc75.zip | |
rt: Do all signalling while holding a lock
This will matter once the scheduler is changed to not wake up on a timer
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 098e9e3c131..a22b3ebc47a 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -394,7 +394,6 @@ rust_task::start(spawn_fn spawnee_fn, void rust_task::start() { transition(&sched->newborn_tasks, &sched->running_tasks); - sched->lock.signal(); } // Only run this on the rust stack @@ -429,8 +428,6 @@ rust_task::kill() { // Unblock the task so it can unwind. unblock(); - sched->lock.signal(); - LOG(this, task, "preparing to unwind task: 0x%" PRIxPTR, this); // run_on_resume(rust_unwind_glue); } @@ -551,6 +548,7 @@ rust_task::transition(rust_task_list *src, rust_task_list *dst) { src->remove(this); dst->append(this); state = dst; + sched->lock.signal(); if(unlock) sched->lock.unlock(); } @@ -578,12 +576,9 @@ rust_task::wakeup(rust_cond *from) { (uintptr_t) cond, (uintptr_t) from); A(sched, cond == from, "Cannot wake up blocked task on wrong condition."); - transition(&sched->blocked_tasks, &sched->running_tasks); - I(sched, cond == from); cond = NULL; cond_name = "none"; - - sched->lock.signal(); + transition(&sched->blocked_tasks, &sched->running_tasks); } void @@ -591,7 +586,6 @@ rust_task::die() { I(sched, !lock.lock_held_by_current_thread()); scoped_lock with(lock); transition(&sched->running_tasks, &sched->dead_tasks); - sched->lock.signal(); } void |
