Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 70 lines (50 sloc) 1.319 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
1dbea76 @brixen Improve handling of auxiliary threads across process changes.
brixen authored
17 class SignalHandler : public AuxiliaryThread, public Lockable {
18 SharedState& shared_;
a6e13ac @evanphx Convert signal handling to use a normal Thread
evanphx authored
19 VM* target_;
20 VM* self_;
07fc27b Hook up signal delivery
Evan Phoenix authored
21
e4c92f8 Rework how signals are delivered. Fixes #356
Evan Phoenix authored
22 int pending_signals_[NSIG];
23 int queued_signals_;
e8ff163 @dbussink Switch signal handler to use mutex and condition instead of pipes
dbussink authored
24
4b66fcb @dbussink Use explicit pausing around fork() for signal handler and finalizer
dbussink authored
25 bool paused_;
5a2ce08 Shutdown the signal handler thread before exec'ing
Evan Phoenix authored
26 bool exit_;
e6bb96a Fix a number of IO/Signal interaction issues
Evan Phoenix authored
27
a6e13ac @evanphx Convert signal handling to use a normal Thread
evanphx authored
28 TypedRoot<Thread*> thread_;
29
b388d90 @evanphx Handle signals during shutdown properly
evanphx authored
30 std::list<int> watched_signals_;
31
e8ff163 @dbussink Switch signal handler to use mutex and condition instead of pipes
dbussink authored
32 utilities::thread::Condition worker_cond_;
4b66fcb @dbussink Use explicit pausing around fork() for signal handler and finalizer
dbussink authored
33 utilities::thread::Condition pause_cond_;
e8ff163 @dbussink Switch signal handler to use mutex and condition instead of pipes
dbussink authored
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
6f86a41 @dbussink Move Agent thread to also have a Ruby thread representation
dbussink 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
6f86a41 @dbussink Move Agent thread to also have a Ruby thread representation
dbussink 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.