13 #ifndef __STOUT_OS_POSIX_SIGNALS_HPP__ 14 #define __STOUT_OS_POSIX_SIGNALS_HPP__ 28 inline int install(
int signal,
void(*handler)(
int))
30 struct sigaction action;
31 memset(&action, 0,
sizeof(action));
32 sigemptyset(&action.sa_mask);
33 action.sa_handler = handler;
34 return sigaction(signal, &action,
nullptr);
41 struct sigaction action;
42 memset(&action, 0,
sizeof(action));
43 sigemptyset(&action.sa_mask);
44 action.sa_handler = SIG_DFL;
45 return sigaction(signal, &action,
nullptr);
55 return sigismember(&
set, signal);
65 sigaddset(&
set, signal);
72 pthread_sigmask(SIG_BLOCK, &
set, &oldset);
74 return !sigismember(&oldset, signal);
84 sigaddset(&
set, signal);
89 pthread_sigmask(SIG_UNBLOCK, &
set, &oldset);
91 return sigismember(&oldset, signal);
103 : signal(_signal), pending(false), unblock(false)
151 pthread_kill(pthread_self(), signal);
156 sigaddset(&mask, signal);
161 result = sigwait(&mask, &_ignored);
162 }
while (result == -1 && errno == EINTR);
175 operator bool() {
return true; }
188 #endif // __STOUT_OS_POSIX_SIGNALS_HPP__ bool pending(int signal)
Definition: signals.hpp:50
Definition: posix_signalhandler.hpp:23
int install(int signal, void(*handler)(int))
Definition: signals.hpp:28
~Suppressor()
Definition: signals.hpp:119
Suppressor(int _signal)
Definition: signals.hpp:102
Definition: signals.hpp:100
Definition: attributes.hpp:24
bool block(int signal)
Definition: signals.hpp:61
int reset(int signal)
Definition: signals.hpp:39
bool unblock(int signal)
Definition: signals.hpp:80