Skip to content

Commit

Permalink
Block GC while creating Thread/Fiber structures.
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed Jun 21, 2016
1 parent 14e9e54 commit b141c77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion machine/builtin/fiber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,11 @@ namespace rubinius {
std::ostringstream name;
name << "fiber." << fiber->fiber_id()->to_native();

fiber->vm(state->vm()->thread_nexus()->new_vm(&state->shared(), name.str().c_str()));
{
BlockPhase blocking(state);
fiber->vm(state->vm()->thread_nexus()->new_vm(&state->shared(), name.str().c_str()));
}

fiber->vm()->set_kind(memory::ManagedThread::eFiber);
fiber->vm()->set_suspending();

Expand Down
6 changes: 4 additions & 2 deletions machine/builtin/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ namespace rubinius {
}

Thread* Thread::create(STATE, Object* self, ThreadFunction function) {
VM* vm = state->shared().thread_nexus()->new_vm(&state->shared());
BlockPhase blocking(state);

return Thread::create(state, self, vm, function);
return Thread::create(state, self,
state->shared().thread_nexus()->new_vm(&state->shared()),
function);
}

Thread* Thread::create(STATE, Object* self, VM* vm, ThreadFunction function) {
Expand Down

0 comments on commit b141c77

Please sign in to comment.