Skip to content
Newer
Older
100644 48 lines (36 sloc) 840 Bytes
07fc27b Hook up signal delivery
Evan Phoenix authored
1 #ifndef RBX_SIGNAL_HPP
2 #define RBX_SIGNAL_HPP
3
4 #include "util/thread.hpp"
5
6 #include <list>
7
8 namespace rubinius {
9 class VM;
6f92669 @dbussink Initial work to enable compiling with clang
dbussink authored
10 struct CallFrame;
07fc27b Hook up signal delivery
Evan Phoenix authored
11
e4c92f8 Rework how signals are delivered. Fixes #356
Evan Phoenix authored
12 class SignalHandler : public thread::Thread {
07fc27b Hook up signal delivery
Evan Phoenix authored
13 VM* vm_;
e4c92f8 Rework how signals are delivered. Fixes #356
Evan Phoenix authored
14 int pending_signals_[NSIG];
15 int running_signals_[NSIG];
16 int queued_signals_;
17 bool executing_signal_;
07fc27b Hook up signal delivery
Evan Phoenix authored
18 thread::SpinLock lock_;
e4c92f8 Rework how signals are delivered. Fixes #356
Evan Phoenix authored
19 int read_fd_;
20 int write_fd_;
5a2ce08 Shutdown the signal handler thread before exec'ing
Evan Phoenix authored
21 bool exit_;
e6bb96a Fix a number of IO/Signal interaction issues
Evan Phoenix authored
22
23 public:
703244b @dbussink Make sure that ignoring a signal actually sets SIG_IGN as handler
dbussink authored
24 enum HandlerType {
25 eDefault,
26 eIgnore,
27 eCustom
28 };
29
e6bb96a Fix a number of IO/Signal interaction issues
Evan Phoenix authored
30 SignalHandler(VM* vm);
e4c92f8 Rework how signals are delivered. Fixes #356
Evan Phoenix authored
31
32 void perform();
33
703244b @dbussink Make sure that ignoring a signal actually sets SIG_IGN as handler
dbussink authored
34 void add_signal(int sig, HandlerType type = eCustom);
e6bb96a Fix a number of IO/Signal interaction issues
Evan Phoenix authored
35 void handle_signal(int sig);
36 static void signal_tramp(int sig);
37
38 void deliver_signals(CallFrame* call_frame);
e4c92f8 Rework how signals are delivered. Fixes #356
Evan Phoenix authored
39
ad006cb Fix ugly signal bug related to pipe fds.
Evan Phoenix authored
40 void reopen_pipes();
e4c92f8 Rework how signals are delivered. Fixes #356
Evan Phoenix authored
41 static void on_fork();
5a2ce08 Shutdown the signal handler thread before exec'ing
Evan Phoenix authored
42 static void shutdown();
43 void shutdown_i();
07fc27b Hook up signal delivery
Evan Phoenix authored
44 };
45 }
46
47 #endif
Something went wrong with that request. Please try again.