Skip to content

Commit

Permalink
Fix race condition when shutting down
Browse files Browse the repository at this point in the history
When we request an auxilary thread to shutdown, maybe another thread is
still waiting to do GC. Therefore we need to guard here so we don't
deadlock when somebody requested a GC but we're also shutting down.

Related to #1952
  • Loading branch information
dbussink committed Oct 11, 2012
1 parent 897570e commit 3fc1656
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vm/environment.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -592,7 +592,10 @@ namespace rubinius {


NativeMethod::cleanup_thread(state); NativeMethod::cleanup_thread(state);


shared->auxiliary_threads()->shutdown(state); {
GCIndependent guard(state);
shared->auxiliary_threads()->shutdown(state);
}


// Hold everyone. // Hold everyone.
while(!state->stop_the_world()) { while(!state->stop_the_world()) {
Expand Down

0 comments on commit 3fc1656

Please sign in to comment.