Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 70 lines (49 sloc) 1.289 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_;
e8ff163 @dbussink Switch signal handler to use mutex and condition instead of pipes
dbussink authored
26
5a2ce08 Shutdown the signal handler thread before exec'ing
Evan Phoenix authored
27 bool exit_;
e6bb96a Fix a number of IO/Signal interaction issues
Evan Phoenix authored
28
a6e13ac @evanphx Convert signal handling to use a normal Thread
evanphx authored
29 TypedRoot<Thread*> thread_;
30
b388d90 @evanphx Handle signals during shutdown properly
evanphx authored
31 std::list<int> watched_signals_;
32
e8ff163 @dbussink Switch signal handler to use mutex and condition instead of pipes
dbussink authored
33 utilities::thread::Condition worker_cond_;
34 utilities::thread::Mutex worker_lock_;
35
e6bb96a Fix a number of IO/Signal interaction issues
Evan Phoenix authored
36 public:
703244b @dbussink Make sure that ignoring a signal actually sets SIG_IGN as handler
dbussink authored
37 enum HandlerType {
38 eDefault,
39 eIgnore,
40 eCustom
41 };
42
35a49f3 @evanphx Introduce State class as STATE
evanphx authored
43 SignalHandler(STATE);
a91f7a3 @dbussink Properly setup destructors for new AuxiliaryThread class
dbussink authored
44 virtual ~SignalHandler();
e4c92f8 Rework how signals are delivered. Fixes #356
Evan Phoenix authored
45
35a49f3 @evanphx Introduce State class as STATE
evanphx authored
46 void perform(State*);
e4c92f8 Rework how signals are delivered. Fixes #356
Evan Phoenix authored
47
35a49f3 @evanphx Introduce State class as STATE
evanphx authored
48 void add_signal(State*, int sig, HandlerType type = eCustom);
e6bb96a Fix a number of IO/Signal interaction issues
Evan Phoenix authored
49 void handle_signal(int sig);
50 static void signal_tramp(int sig);
51
35a49f3 @evanphx Introduce State class as STATE
evanphx authored
52 bool deliver_signals(STATE, CallFrame* call_frame);
e4c92f8 Rework how signals are delivered. Fixes #356
Evan Phoenix authored
53
1dbea76 @brixen Improve handling of auxiliary threads across process changes.
brixen authored
54 void open_pipes();
55 void start_thread(STATE);
56 void stop_thread(STATE);
a6e13ac @evanphx Convert signal handling to use a normal Thread
evanphx authored
57
1dbea76 @brixen Improve handling of auxiliary threads across process changes.
brixen authored
58 void shutdown(STATE);
59 void before_exec(STATE);
60 void after_exec(STATE);
61 void before_fork(STATE);
62 void after_fork_parent(STATE);
63 void after_fork_child(STATE);
a6e13ac @evanphx Convert signal handling to use a normal Thread
evanphx authored
64
35a49f3 @evanphx Introduce State class as STATE
evanphx authored
65 void run(State*);
07fc27b Hook up signal delivery
Evan Phoenix authored
66 };
67 }
68
69 #endif
Something went wrong with that request. Please try again.