uvw  2.10.0
signal.h
1 #ifndef UVW_SIGNAL_INCLUDE_H
2 #define UVW_SIGNAL_INCLUDE_H
3 
4 
5 #include <uv.h>
6 #include "handle.hpp"
7 #include "loop.h"
8 
9 
10 namespace uvw {
11 
12 
18 struct SignalEvent {
19  explicit SignalEvent(int sig) noexcept;
20 
21  int signum;
22 };
23 
24 
38 class SignalHandle final: public Handle<SignalHandle, uv_signal_t> {
39  static void startCallback(uv_signal_t *handle, int signum);
40 
41 public:
42  using Handle::Handle;
43 
48  bool init();
49 
57  void start(int signum);
58 
67  void oneShot(int signum);
68 
72  void stop();
73 
78  int signal() const noexcept;
79 };
80 
81 
82 }
83 
84 
85 #ifndef UVW_AS_LIB
86 #include "signal.cpp"
87 #endif
88 
89 #endif // UVW_SIGNAL_INCLUDE_H
Handle base class.
Definition: handle.hpp:30
The SignalHandle handle.
Definition: signal.h:38
void start(int signum)
Starts the handle.
void stop()
Stops the handle.
bool init()
Initializes the handle.
void oneShot(int signum)
Starts the handle.
int signal() const noexcept
Gets the signal being monitored.
uvw default namespace.
Definition: async.h:10
SignalEvent event.
Definition: signal.h:18