19 #ifndef CORE_POSIX_SIGNAL_H_
20 #define CORE_POSIX_SIGNAL_H_
24 #include <core/signal.h>
28 #include <initializer_list>
83 virtual void run() = 0;
104 std::initializer_list<core::posix::Signal> blocked_signals);
112 std::initializer_list<core::posix::Signal> blocked_signals);
The SignalTrap class encapsulates functionality to trap and handle signals.
SignalTrap & operator=(const SignalTrap &)=delete
virtual bool has(Signal signal)=0
Returns true if the given signal is trapped by this instance.
virtual ~SignalTrap()=default
virtual core::Signal< Signal > & signal_raised()=0
Emitted whenever a trapped signal is raised by the operating system.
SignalTrap(const SignalTrap &)=delete
virtual void run()=0
Starts observation of incoming signals, relaying them via signal_raised(). The call blocks until stop...
bool operator==(const SignalTrap &) const =delete
virtual void stop()=0
Stops execution of the signal trap.
Signal
The Signal enum collects the most common POSIX signals.
CORE_POSIX_DLL_PUBLIC std::shared_ptr< SignalTrap > trap_signals_for_process(std::initializer_list< core::posix::Signal > blocked_signals)
Traps the specified signals for the entire process.
CORE_POSIX_DLL_PUBLIC std::shared_ptr< SignalTrap > trap_signals_for_all_subsequent_threads(std::initializer_list< core::posix::Signal > blocked_signals)
Traps the specified signals for the current thread, and inherits the respective signal mask to all ch...
#define CORE_POSIX_DLL_PUBLIC