]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: fd: Add fd_active function
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 30 Aug 2017 07:59:38 +0000 (09:59 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 5 Sep 2017 08:39:46 +0000 (10:39 +0200)
This inlined function is used to check if a fd is active for receive or send. It
will ease threads support integration.

include/proto/fd.h

index 38c12b687ea564ba41c62d3c993861aa0c0dab2a..526f895950f772581202d79e64d642eefe034e1c 100644 (file)
@@ -241,6 +241,14 @@ static inline int fd_send_polled(const int fd)
        return (unsigned)fdtab[fd].state & FD_EV_POLLED_W;
 }
 
+/*
+ * returns true if the FD is active for recv or send
+ */
+static inline int fd_active(const int fd)
+{
+       return (unsigned)fdtab[fd].state & FD_EV_ACTIVE_RW;
+}
+
 /* Disable processing recv events on fd <fd> */
 static inline void fd_stop_recv(int fd)
 {