From 863ae1143f9336f300c300c4d62165c3eac22834 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Wed, 10 Feb 2021 16:17:36 +0100 Subject: fdm: add support for managing signals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add fdm_signal_add() and fdm_signal_del(). Signals added to the fdm will be monitored, and the provided callback called as “soon as possible” from the main context (i.e not from the signal handler context). Monitored signals are *blocked* by default. We use epoll_pwait() to unblock them while we’re polling. This allows us to do race-free signal detection. We use a single handler for all monitored signals; the handler simply updates the signal’s slot in a global array (sized to fit SIGRTMAX signals). When epoll_pwait() returns EINTR, we loop the global array. The callback associated with each signal that fired is called. --- pgo/pgo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pgo') diff --git a/pgo/pgo.c b/pgo/pgo.c index 4bb67d35..933d100c 100644 --- a/pgo/pgo.c +++ b/pgo/pgo.c @@ -35,7 +35,7 @@ async_write(int fd, const void *data, size_t len, size_t *idx) } bool -fdm_add(struct fdm *fdm, int fd, int events, fdm_handler_t handler, void *data) +fdm_add(struct fdm *fdm, int fd, int events, fdm_fd_handler_t handler, void *data) { return true; } -- cgit v1.3