fixed some bugs in the signal related functions of the QSE::App class

This commit is contained in:
2018-09-04 08:46:48 +00:00
parent bb7a03bbc5
commit 82995c9f0d
4 changed files with 112 additions and 37 deletions

View File

@ -78,15 +78,27 @@ public:
_SigLink _sig[QSE_NSIGS];
public:
typedef void (*SignalHandler) (int sig);
static int setSignalHandler (int sig, SignalHandler sighr);
static int unsetSignalHandler (int sig);
static qse_size_t _sighrs[2][QSE_NSIGS];
void handleSignal (int sig, bool accept);
void unhandleSignal (int sig);
int subscribeToSignal (int sig, bool accept);
void unsubscribeFromSignal (int sig);
// You may set a global signal handler with setSignalHandler().
// If an application is subscribing to a single with subscribeToSignal(),
// this function is doomed to fail. If a successful call to
// setSignalHandler() has been made withoutut unsetSingalHandler() called
// yet, a subsequence call to subscribeToSignal() is doomed to fail too.
// These two different interfaces are mutually exclusive.
static int setSignalHandler (int sig, SignalHandler sighr);
static int unsetSignalHandler (int sig);
protected:
static int set_signal_handler_no_mutex (int sig, SignalHandler sighr);
static int unset_signal_handler_no_mutex (int sig);
void unsubscribe_from_signal_no_mutex (int sig);
void unsubscribe_from_all_signals_no_mutex ();
};
// functor as a template parameter