Permalink
Browse files

Update thread status for running threads when reinitting

Fixes #2888, Fixes #2861
  • Loading branch information...
1 parent 85b6491 commit 75552bb4bfaafeac2f9c381cb912e1e84bedca25 @dbussink dbussink committed Feb 2, 2014
Showing with 20 additions and 2 deletions.
  1. +18 −2 vm/shared_state.cpp
  2. +2 −0 vm/shared_state.hpp
View
@@ -165,15 +165,31 @@ namespace rubinius {
return agent_;
}
+ void SharedState::reset_threads(STATE) {
+ VM* current = state->vm();
+ for(ThreadList::iterator i = threads_.begin();
+ i != threads_.end();
+ ++i) {
+ if(VM* vm = (*i)->as_vm()) {
+ if(vm == current) continue;
+ Thread* thread = vm->thread.get();
+ thread->alive(state, cFalse);
+ thread->killed(state, cTrue);
+ }
+ }
+ threads_.clear();
+ threads_.push_back(current);
+ }
+
void SharedState::reinit(STATE) {
// For now, we disable inline debugging here. This makes inspecting
// it much less confusing.
config.jit_inline_debug.set("no");
env_->set_root_vm(state->vm());
- threads_.clear();
- threads_.push_back(state->vm());
+
+ reset_threads(state);
// Reinit the locks for this object
lock_init(state->vm());
View
@@ -119,6 +119,8 @@ namespace rubinius {
bool use_capi_lock_;
int primitive_hits_[Primitives::cTotalPrimitives];
+ void reset_threads(STATE);
+
public:
Globals globals;
ObjectMemory* om;

0 comments on commit 75552bb

Please sign in to comment.