From: Christopher Faulet Date: Wed, 30 Aug 2017 08:30:04 +0000 (+0200) Subject: MINOR: fd: Add fd_update_events function X-Git-Tag: v1.8-dev3~116 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21e9267ac3bd8642307b0f9791d3e46998141620;p=thirdparty%2Fhaproxy.git MINOR: fd: Add fd_update_events function This function should be called by the poller to set FD_POLL_* flags on an FD and update its state if needed. This function has been added to ease threads support integration. --- diff --git a/include/proto/fd.h b/include/proto/fd.h index 14b2849420..56e20827ca 100644 --- a/include/proto/fd.h +++ b/include/proto/fd.h @@ -343,6 +343,20 @@ static inline void fd_want_send(int fd) } } +/* Update events seen for FD and its state if needed. This should be called + * by the poller to set FD_POLL_* flags. */ +static inline void fd_update_events(int fd, int evts) +{ + fdtab[fd].ev &= FD_POLL_STICKY; + fdtab[fd].ev |= evts; + + if (fdtab[fd].ev & (FD_POLL_IN | FD_POLL_HUP | FD_POLL_ERR)) + fd_may_recv(fd); + + if (fdtab[fd].ev & (FD_POLL_OUT | FD_POLL_ERR)) + fd_may_send(fd); +} + /* Prepares for being polled */ static inline void fd_insert(int fd) {