diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-03-03 02:36:53 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-03-05 19:39:55 -0800 |
| commit | 2465a63a69ea51d4fce10430b6a8fd0079cbbcd5 (patch) | |
| tree | 70e01ec8c8c3cad74a0e9221cd5cfa229c4c1a14 /src/rt/rust_task.cpp | |
| parent | 237652299ec5fa3529ac7bd1bfddc52b7526bb82 (diff) | |
| download | rust-2465a63a69ea51d4fce10430b6a8fd0079cbbcd5.tar.gz rust-2465a63a69ea51d4fce10430b6a8fd0079cbbcd5.zip | |
rt: Move transition from rust_task to rust_task_thread
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 3c375f0b4c3..0e9e7b2eb85 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -401,26 +401,16 @@ rust_task::free(void *p) void rust_task::transition(rust_task_list *src, rust_task_list *dst, rust_cond *cond, const char* cond_name) { - bool unlock = false; - if(!thread->lock.lock_held_by_current_thread()) { - unlock = true; - thread->lock.lock(); - } - DLOG(thread, task, - "task %s " PTR " state change '%s' -> '%s' while in '%s'", - name, (uintptr_t)this, src->name, dst->name, state->name); - I(thread, state == src); - src->remove(this); - dst->append(this); - { - scoped_lock with(state_lock); - state = dst; - this->cond = cond; - this->cond_name = cond_name; - } - thread->lock.signal(); - if(unlock) - thread->lock.unlock(); + thread->transition(this, src, dst, cond, cond_name); +} + +void +rust_task::set_state(rust_task_list *state, + rust_cond *cond, const char* cond_name) { + scoped_lock with(state_lock); + this->state = state; + this->cond = cond; + this->cond_name = cond_name; } void |
