about summary refs log tree commit diff
path: root/src/rt/rust_task_thread.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-03-17 17:39:46 -0700
committerBrian Anderson <banderson@mozilla.com>2012-03-17 18:44:41 -0700
commit132266b2cbb0f92608fb7f1fca90d2b743f7759d (patch)
treea3d9e965932a0c39f59cad95ee29a2261387bb23 /src/rt/rust_task_thread.cpp
parent3ee4a15e5e1be8d1baa529ccf2c64ba4a88abc93 (diff)
downloadrust-132266b2cbb0f92608fb7f1fca90d2b743f7759d.tar.gz
rust-132266b2cbb0f92608fb7f1fca90d2b743f7759d.zip
rt: Remove the recursive lock from rust_task_thread
Diffstat (limited to 'src/rt/rust_task_thread.cpp')
-rw-r--r--src/rt/rust_task_thread.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/rt/rust_task_thread.cpp b/src/rt/rust_task_thread.cpp
index 3c3c11b0a1e..63dcd3c846b 100644
--- a/src/rt/rust_task_thread.cpp
+++ b/src/rt/rust_task_thread.cpp
@@ -308,11 +308,7 @@ void
 rust_task_thread::transition(rust_task *task,
                              rust_task_list *src, rust_task_list *dst,
                              rust_cond *cond, const char* cond_name) {
-    bool unlock = false;
-    if(!lock.lock_held_by_current_thread()) {
-        unlock = true;
-        lock.lock();
-    }
+    scoped_lock with(lock);
     DLOG(this, task,
          "task %s " PTR " state change '%s' -> '%s' while in '%s'",
          name, (uintptr_t)this, src->name, dst->name,
@@ -323,8 +319,6 @@ rust_task_thread::transition(rust_task *task,
     task->set_state(dst, cond, cond_name);
 
     lock.signal();
-    if(unlock)
-        lock.unlock();
 }
 
 void rust_task_thread::run() {