Skip to content

Commit

Permalink
Remove a VM from the threads list when discarding it
Browse files Browse the repository at this point in the history
Previously there were cases where we weren't properly removing the
thread from the threads list. This happened for example for the
SignalHandler thread and QueryAgent thread.

By always removing it from the threads list from VM::discard, we make
sure it's always remove and does not cause a crash when the GC tries to
scan a thread that was not running anymore.
  • Loading branch information
dbussink committed Mar 16, 2012
1 parent a8a5f52 commit 050ffbb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 0 additions & 2 deletions vm/builtin/thread.cpp
Expand Up @@ -228,8 +228,6 @@ namespace rubinius {
vm->thread->cleanup();
vm->thread->init_lock_.unlock();

vm->shared.remove_managed_thread(vm);

// Clear the call_frame, so that if we wait for GC going independent,
// the GC doesn't see pointers into now-unallocated CallFrames
vm->set_call_frame(0);
Expand Down
1 change: 1 addition & 0 deletions vm/shared_state.cpp
Expand Up @@ -125,6 +125,7 @@ namespace rubinius {

void SharedState::remove_vm(VM* vm) {
SYNC_TL;
threads_.remove(vm);
this->deref();

// Don't delete ourself here, it's too problematic.
Expand Down

0 comments on commit 050ffbb

Please sign in to comment.