Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use LockGuards where appropriate as RAII

  • Loading branch information...
commit 27e3de4eae455f8bd43787b427e593c6829582d3 1 parent 0fcb78a
@ryoqun ryoqun authored
Showing with 2 additions and 6 deletions.
  1. +2 −6 vm/builtin/thread.cpp
View
8 vm/builtin/thread.cpp
@@ -322,20 +322,18 @@ namespace rubinius {
}
Object* Thread::raise(STATE, GCToken gct, Exception* exc) {
- init_lock_.lock();
+ utilities::thread::SpinLock::LockGuard lg(init_lock_);
Thread* self = this;
OnStack<2> os(state, self, exc);
VM* vm = self->vm_;
if(!vm) {
- self->init_lock_.unlock();
return cNil;
}
vm->register_raise(state, exc);
vm->wakeup(state, gct);
- self->init_lock_.unlock();
return exc;
}
@@ -344,19 +342,17 @@ namespace rubinius {
}
Thread* Thread::wakeup(STATE, GCToken gct) {
- init_lock_.lock();
+ utilities::thread::SpinLock::LockGuard lg(init_lock_);
Thread* self = this;
OnStack<1> os(state, self);
VM* vm = self->vm_;
if(alive() == cFalse || !vm) {
- self->init_lock_.unlock();
return force_as<Thread>(Primitives::failure());
}
vm->wakeup(state, gct);
- self->init_lock_.unlock();
return self;
}
Please sign in to comment.
Something went wrong with that request. Please try again.