Skip to content

Commit

Permalink
Don't expose the sig handler thread by Thread.list
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun committed May 18, 2012
1 parent d1f1004 commit f32161f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions vm/builtin/thread.hpp
Expand Up @@ -3,6 +3,7 @@

#include "vm/exception.hpp"
#include "vm/type_info.hpp"
#include "vm/signal.hpp"

#include "builtin/object.hpp"
#include "builtin/randomizer.hpp"
Expand Down Expand Up @@ -76,6 +77,10 @@ namespace rubinius {
return vm_;
}

bool signal_handler_thread_p() {
return runner_ == handle_tramp;
}

public:

/**
Expand Down
6 changes: 5 additions & 1 deletion vm/shared_state.cpp
Expand Up @@ -17,6 +17,7 @@
#include "world_state.hpp"
#include "builtin/randomizer.hpp"
#include "builtin/array.hpp"
#include "builtin/thread.hpp"

#ifdef ENABLE_LLVM
#include "llvm/state.hpp"
Expand Down Expand Up @@ -140,7 +141,10 @@ namespace rubinius {
i != threads_.end();
++i) {
if(VM* vm = (*i)->as_vm()) {
threads->append(state, (Object*)vm->thread.get());
Thread *thread = vm->thread.get();
if(!thread->signal_handler_thread_p()) {
threads->append(state, (Object*)thread);
}
}
}
return threads;
Expand Down
2 changes: 2 additions & 0 deletions vm/signal.hpp
Expand Up @@ -13,6 +13,8 @@ namespace rubinius {
struct CallFrame;
class Thread;

Object* handle_tramp(STATE);

class SignalHandler : public Lockable {
VM* target_;
VM* self_;
Expand Down

0 comments on commit f32161f

Please sign in to comment.