You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2022/01/27 14:21:39 UTC

svn commit: r1897550 - in /apr/apr/branches/1.8.x: ./ include/apr_poll.h poll/unix/epoll.c

Author: ylavic
Date: Thu Jan 27 14:21:39 2022
New Revision: 1897550

URL: http://svn.apache.org/viewvc?rev=1897550&view=rev
Log:
poll: Provide APR_POLLEXCL for exclusive wake up on systems that support it.

epoll has EPOLLEXCLUSIVE, start with that.


poll: Follow up to r1897521: struct epoll_event's events field is unsigned int.

EPOLLEXCLUSIVE is 1u << 28 so it doesn't fit in an int16_t, use unsigned for
the native epoll events type.


poll: Follow up to r1897521: Clarify what APR_POLLEXCL means.

This is to avoid the thundering herd issue when multiple threads/processes
poll on the same descriptor (usually listening/to-be-accept()ed descriptors).


Merge r1897521, r1897548, r1897549 from trunk.
Submitted by: ylavic
Reviewed by: ylavic

Modified:
    apr/apr/branches/1.8.x/   (props changed)
    apr/apr/branches/1.8.x/include/apr_poll.h
    apr/apr/branches/1.8.x/poll/unix/epoll.c

Propchange: apr/apr/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r1897521,1897548-1897549

Modified: apr/apr/branches/1.8.x/include/apr_poll.h
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.8.x/include/apr_poll.h?rev=1897550&r1=1897549&r2=1897550&view=diff
==============================================================================
--- apr/apr/branches/1.8.x/include/apr_poll.h (original)
+++ apr/apr/branches/1.8.x/include/apr_poll.h Thu Jan 27 14:21:39 2022
@@ -52,6 +52,7 @@ extern "C" {
 #define APR_POLLERR   0x010     /**< Pending error */
 #define APR_POLLHUP   0x020     /**< Hangup occurred */
 #define APR_POLLNVAL  0x040     /**< Descriptor invalid */
+#define APR_POLLEXCL  0x080     /**< Exclusive wake up */
 /** @} */
 
 /**

Modified: apr/apr/branches/1.8.x/poll/unix/epoll.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.8.x/poll/unix/epoll.c?rev=1897550&r1=1897549&r2=1897550&view=diff
==============================================================================
--- apr/apr/branches/1.8.x/poll/unix/epoll.c (original)
+++ apr/apr/branches/1.8.x/poll/unix/epoll.c Thu Jan 27 14:21:39 2022
@@ -25,9 +25,9 @@
 
 #if defined(HAVE_EPOLL)
 
-static apr_int16_t get_epoll_event(apr_int16_t event)
+static unsigned get_epoll_event(apr_int16_t event)
 {
-    apr_int16_t rv = 0;
+    unsigned rv = 0;
 
     if (event & APR_POLLIN)
         rv |= EPOLLIN;
@@ -35,12 +35,16 @@ static apr_int16_t get_epoll_event(apr_i
         rv |= EPOLLPRI;
     if (event & APR_POLLOUT)
         rv |= EPOLLOUT;
+#ifdef EPOLLEXCLUSIVE
+    if (event & APR_POLLEXCL)
+        rv |= EPOLLEXCLUSIVE;
+#endif
     /* APR_POLLNVAL is not handled by epoll.  EPOLLERR and EPOLLHUP are return-only */
 
     return rv;
 }
 
-static apr_int16_t get_epoll_revent(apr_int16_t event)
+static apr_int16_t get_epoll_revent(unsigned event)
 {
     apr_int16_t rv = 0;