8 #define SCARAB_API_EXPORTS 26 LOGGER( slog,
"signal_handler" );
41 throw error() <<
"Unable to handle SIGINT\n";
52 throw error() <<
"Unable to handle SIGQUIT\n";
59 if( signal(SIGPIPE, SIG_IGN) == SIG_ERR )
61 throw error() <<
"Unable to ignore SIGPIPE\n";
104 LPROG( slog,
"\n\nHello! Your signal is being handled by signal_handler.\n" 105 <<
"Have a nice day!\n" );
112 LDEBUG( slog,
"Canceling all cancelables" );
120 std::this_thread::sleep_for( std::chrono::seconds(1) );
125 ExitProcess( a_code );
static bool f_handling_sig_int
LOGGER(mtlog, "authentication")
static bool f_got_exit_signal
Contains the logger class and macros, based on Kasper's KLogger class.
static std::mutex f_mutex
static void cancel_all(int a_code)
Asynchronous call to exit the process with the given exit code.
static bool got_exit_signal()
Check whether an exit signal has been received.
static void handler_cancel_threads(int _ignored)
Signal handler function.
static bool f_handling_sig_quit
static cancelers f_cancelers
void add_cancelable(cancelable *a_cancelable)
Add a cancelable object.
void remove_cancelable(cancelable *a_cancelable)
Remove a cancelable object.
void reset()
Remove all cancelables.
virtual ~signal_handler()
std::set< cancelable *> cancelers