Skip to content

Commit

Permalink
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions machine/builtin/fiber.cpp
Original file line number Diff line number Diff line change
@@ -74,13 +74,13 @@ namespace rubinius {
}

void Fiber::restart(STATE) {
if(!vm()->suspended_p()) {
Exception::raise_fiber_error(state, "attempt to restart non-suspended fiber");
}

{
std::lock_guard<std::mutex> guard(state->vm()->thread()->fiber_mutex());

if(!vm()->suspended_p()) {
Exception::raise_fiber_error(state, "attempt to restart non-suspended fiber");
}

while(vm()->suspended_p()) {
std::lock_guard<std::mutex> guard(vm()->wait_mutex());
vm()->wait_condition().notify_one();
@@ -93,7 +93,10 @@ namespace rubinius {
; // spin wait
}

state->vm()->thread()->current_fiber(state, this);
{
std::lock_guard<std::mutex> guard(state->vm()->thread()->fiber_mutex());
state->vm()->thread()->current_fiber(state, this);
}
}

void Fiber::suspend(STATE) {

0 comments on commit 50a8915

Please sign in to comment.