From cf1335f2580ae303ace3bac6fa0d1a25c7d5b60d 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 fa95a0ec..1b0b4641 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