summaryrefslogtreecommitdiffstats
path: root/lib/sigevent.h
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2020-09-02 22:25:00 +0200
committerMark Stapp <mjs@voltanet.io>2020-10-26 21:46:40 +0100
commit976c5cc134bb96f309479d281d771d70dbe41f13 (patch)
treec1ec4e9566e8844566afa1e220b52257a415e500 /lib/sigevent.h
parentMerge pull request #7376 from mjstapp/fix_pim_align (diff)
downloadfrr-976c5cc134bb96f309479d281d771d70dbe41f13.tar.xz
frr-976c5cc134bb96f309479d281d771d70dbe41f13.zip
lib: add sigevent_check api
Add an api that blocks application-handled signals (SIGINT, SIGTERM, e.g.) then tests whether any signals have been received. This helps to manage a race between signal reception and the poll call in the main event loop. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'lib/sigevent.h')
-rw-r--r--lib/sigevent.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sigevent.h b/lib/sigevent.h
index a0ad88fca..4a39b2288 100644
--- a/lib/sigevent.h
+++ b/lib/sigevent.h
@@ -48,6 +48,15 @@ struct quagga_signal_t {
extern void signal_init(struct thread_master *m, int sigc,
struct quagga_signal_t *signals);
+
+/*
+ * Check whether any signals have been received and are pending. This is done
+ * with the application's key signals blocked. The complete set of signals
+ * is returned in 'setp', so the caller can restore them when appropriate.
+ * If there are pending signals, returns 'true', 'false' otherwise.
+ */
+bool frr_sigevent_check(sigset_t *setp);
+
/* check whether there are signals to handle, process any found */
extern int quagga_sigevent_process(void);