Skip to content

Commit 1d60cbe

Browse files
committedJul 9, 2015
Remove threads from list when they finish executing.
1 parent a9fa225 commit 1d60cbe

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed
 

‎vm/builtin/thread.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ namespace rubinius {
329329

330330
shared.gc_independent();
331331

332-
vm->set_zombie();
332+
vm->set_zombie(state);
333333

334334
RUBINIUS_THREAD_STOP(
335335
const_cast<RBX_DTRACE_CHAR_P>(vm->name().c_str()), vm->thread_id(), 0);

‎vm/internal_threads.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ namespace rubinius {
3939

4040
thread->run(state);
4141

42+
vm->set_call_frame(0);
4243
thread->thread_running_ = false;
4344

4445
NativeMethod::cleanup_thread(state);
@@ -48,6 +49,8 @@ namespace rubinius {
4849

4950
shared.gc_independent();
5051

52+
vm->set_zombie(state);
53+
5154
return 0;
5255
}
5356

‎vm/vm.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ namespace rubinius {
107107

108108
void VM::discard(STATE, VM* vm) {
109109
vm->saved_call_frame_ = 0;
110-
vm->shared.remove_vm(vm);
111110

112111
state->vm()->metrics().system.threads_destroyed++;
113112

114113
delete vm;
115114
}
116115

117-
void VM::set_zombie() {
116+
void VM::set_zombie(STATE) {
117+
state->shared().remove_vm(this);
118118
thread.set(nil<Thread>());
119119
zombie_ = true;
120120
}

‎vm/vm.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ namespace rubinius {
154154
return interrupt_lock_;
155155
}
156156

157-
void set_zombie();
157+
void set_zombie(STATE);
158158

159159
bool zombie_p() {
160160
return zombie_;

0 commit comments

Comments
 (0)
Please sign in to comment.