It is developed according to the common approach for multi-threaded programs.
void init()
void setHandler(int signum, std::function<void()> handler, bool terminate = false)
Listen the unix signals. Blocks current thread. It can be unblocked if handler with flag terminate=true was triggered.
void listen()
void setTerminateSignal(int signum)
void setSigIgnore(int signum)
void setTimeoutHandler(uint timeout, std::function<void()> handler)
Build and Run example:
g++ example.cpp -o unix_example -pthread
./unix_example
pkill unix_example (from other terminal)