Browse files

Fix race condition when shutting down

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...
1 parent 897570e commit 3fc165672112b98ba7ec8307064df5ea5e7f650b @dbussink dbussink committed Oct 11, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 vm/environment.cpp
View
5 vm/environment.cpp
@@ -592,7 +592,10 @@ namespace rubinius {
NativeMethod::cleanup_thread(state);
- shared->auxiliary_threads()->shutdown(state);
+ {
+ GCIndependent guard(state);
+ shared->auxiliary_threads()->shutdown(state);
+ }
// Hold everyone.
while(!state->stop_the_world()) {

0 comments on commit 3fc1656

Please sign in to comment.