Skip to content
Newer
Older
100644 69 lines (50 sloc) 1.23 KB
07fc27b Hook up signal delivery
Evan Phoenix authored
1 #ifndef RBX_SIGNAL_HPP
2 #define RBX_SIGNAL_HPP
3
4147f9a Add locking to SignalHandler
Evan Phoenix authored
4 #include "lock.hpp"
1dbea76 @brixen Improve handling of auxiliary threads across process changes.
brixen authored
5 #include "auxiliary_threads.hpp"
07fc27b Hook up signal delivery
Evan Phoenix authored
6
a6e13ac @evanphx Convert signal handling to use a normal Thread
evanphx authored
7 #include "gc/root.hpp"
8
07fc27b Hook up signal delivery
Evan Phoenix authored
9 #include <list>
10
11 namespace rubinius {
12 class VM;
35a49f3 @evanphx Introduce State class as STATE
evanphx authored
13 class State;
6f92669 @dbussink Initial work to enable compiling with clang
dbussink authored
14 struct CallFrame;
a6e13ac @evanphx Convert signal handling to use a normal Thread
evanphx authored
15 class Thread;
16
f32161f @ryoqun Don't expose the sig handler thread by Thread.list
ryoqun authored
17 Object* handle_tramp(STATE);
18
1dbea76 @brixen Improve handling of auxiliary threads across process changes.
brixen authored
19 class SignalHandler : public AuxiliaryThread, public Lockable {
20 SharedState& shared_;
a6e13ac @evanphx Convert signal handling to use a normal Thread
evanphx authored
21 VM* target_;
22 VM* self_;
07fc27b Hook up signal delivery
Evan Phoenix authored
23
e4c92f8 Rework how signals are delivered. Fixes #356
Evan Phoenix authored
24 int pending_signals_[NSIG];
25 int queued_signals_;
07fc27b Hook up signal delivery
Evan Phoenix authored
26 thread::SpinLock lock_;
e4c92f8 Rework how signals are delivered. Fixes #356
Evan Phoenix authored
27 int read_fd_;
28 int write_fd_;
5a2ce08 Shutdown the signal handler thread before exec'ing
Evan Phoenix authored
29 bool exit_;
e6bb96a Fix a number of IO/Signal interaction issues
Evan Phoenix authored
30
a6e13ac @evanphx Convert signal handling to use a normal Thread
evanphx authored
31 TypedRoot<Thread*> thread_;
32
b388d90 @evanphx Handle signals during shutdown properly
evanphx authored
33 std::list<int> watched_signals_;
34
e6bb96a Fix a number of IO/Signal interaction issues
Evan Phoenix authored
35 public:
703244b @dbussink Make sure that ignoring a signal actually sets SIG_IGN as handler
dbussink authored
36 enum HandlerType {
37 eDefault,
38 eIgnore,
39 eCustom
40 };
41
35a49f3 @evanphx Introduce State class as STATE
evanphx authored
42 SignalHandler(STATE);
a91f7a3 @dbussink Properly setup destructors for new AuxiliaryThread class
dbussink authored
43 virtual ~SignalHandler();
e4c92f8 Rework how signals are delivered. Fixes #356
Evan Phoenix authored
44
35a49f3 @evanphx Introduce State class as STATE
evanphx authored
45 void perform(State*);
e4c92f8 Rework how signals are delivered. Fixes #356
Evan Phoenix authored
46
35a49f3 @evanphx Introduce State class as STATE
evanphx authored
47 void add_signal(State*, int sig, HandlerType type = eCustom);
e6bb96a Fix a number of IO/Signal interaction issues
Evan Phoenix authored
48 void handle_signal(int sig);
49 static void signal_tramp(int sig);
50
35a49f3 @evanphx Introduce State class as STATE
evanphx authored
51 bool deliver_signals(STATE, CallFrame* call_frame);
e4c92f8 Rework how signals are delivered. Fixes #356
Evan Phoenix authored
52
1dbea76 @brixen Improve handling of auxiliary threads across process changes.
brixen authored
53 void open_pipes();
54 void start_thread(STATE);
55 void stop_thread(STATE);
a6e13ac @evanphx Convert signal handling to use a normal Thread
evanphx authored
56
1dbea76 @brixen Improve handling of auxiliary threads across process changes.
brixen authored
57 void shutdown(STATE);
58 void before_exec(STATE);
59 void after_exec(STATE);
60 void before_fork(STATE);
61 void after_fork_parent(STATE);
62 void after_fork_child(STATE);
a6e13ac @evanphx Convert signal handling to use a normal Thread
evanphx authored
63
35a49f3 @evanphx Introduce State class as STATE
evanphx authored
64 void run(State*);
07fc27b Hook up signal delivery
Evan Phoenix authored
65 };
66 }
67
68 #endif
Something went wrong with that request. Please try again.