Permalink
Browse files

Add locking to SignalHandler

  • Loading branch information...
1 parent 1e5e901 commit 4147f9a1f4d10f225262f3570fce28a953969e75 Evan Phoenix committed Sep 29, 2010
Showing with 8 additions and 5 deletions.
  1. +2 −2 vm/builtin/system.cpp
  2. +3 −1 vm/signal.cpp
  3. +3 −2 vm/signal.hpp
View
@@ -508,9 +508,9 @@ namespace rubinius {
if(h) {
native_int i = sig->to_native();
if(i < 0) {
- h->add_signal(-i, true);
+ h->add_signal(state, -i, true);
} else {
- h->add_signal(i);
+ h->add_signal(state, i);
}
return Qtrue;
View
@@ -120,7 +120,9 @@ namespace rubinius {
}
}
- void SignalHandler::add_signal(int sig, bool def) {
+ void SignalHandler::add_signal(STATE, int sig, bool def) {
+ SYNC(state);
+
sigset_t sigs;
sigemptyset(&sigs);
sigaddset(&sigs, sig);
View
@@ -2,14 +2,15 @@
#define RBX_SIGNAL_HPP
#include "util/thread.hpp"
+#include "lock.hpp"
#include <list>
namespace rubinius {
class VM;
struct CallFrame;
- class SignalHandler : public thread::Thread {
+ class SignalHandler : public thread::Thread, Lockable {
VM* vm_;
int pending_signals_[NSIG];
int queued_signals_;
@@ -24,7 +25,7 @@ namespace rubinius {
void perform();
- void add_signal(int sig, bool def=false);
+ void add_signal(VM*, int sig, bool def=false);
void handle_signal(int sig);
static void signal_tramp(int sig);

0 comments on commit 4147f9a

Please sign in to comment.