about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--ext/sleepy_penguin/epoll.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/sleepy_penguin/epoll.c b/ext/sleepy_penguin/epoll.c
index 8155c4a..09c4bf7 100644
--- a/ext/sleepy_penguin/epoll.c
+++ b/ext/sleepy_penguin/epoll.c
@@ -306,6 +306,17 @@ void sleepy_penguin_init_epoll(void)
         rb_define_const(cEpoll, "WAKEUP", UINT2NUM(EPOLLWAKEUP));
 #endif
 
+#ifdef EPOLLEXCLUSIVE
+        /*
+         * Sets an exclusive wakeup mode for the epoll object
+         * that is being attached to the target IO.  This
+         * avoids thundering herd scenarios when the same
+         * target IO is shared among multiple epoll objects.
+         * Available since Linux 4.5
+         */
+        rb_define_const(cEpoll, "EXCLUSIVE", UINT2NUM(EPOLLEXCLUSIVE));
+#endif
+
         /* watch for urgent read(2) data */
         rb_define_const(cEpoll, "PRI", UINT2NUM(EPOLLPRI));