apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
Subject svn commit: r1819858 - /apr/apr/trunk/poll/unix/port.c
Date Tue, 02 Jan 2018 17:28:53 GMT
Author: ylavic
Date: Tue Jan  2 17:28:53 2018
New Revision: 1819858

URL: http://svn.apache.org/viewvc?rev=1819858&view=rev
Log:
poll, port: re-add the wakeup pipe to the pollset after it triggered.

Just like user fds (file, socket), otherwise it's one shot only (PR-61786).

Corresponding test committed in r1819857.


Modified:
    apr/apr/trunk/poll/unix/port.c

Modified: apr/apr/trunk/poll/unix/port.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/poll/unix/port.c?rev=1819858&r1=1819857&r2=1819858&view=diff
==============================================================================
--- apr/apr/trunk/poll/unix/port.c (original)
+++ apr/apr/trunk/poll/unix/port.c Tue Jan  2 17:28:53 2018
@@ -358,7 +358,6 @@ static apr_status_t impl_pollset_poll(ap
     unsigned int nget;
     pfd_elem_t *ep;
     apr_status_t rv = APR_SUCCESS;
-    apr_pollfd_t fp;
 
     *num = 0;
     nget = 1;
@@ -409,32 +408,30 @@ static apr_status_t impl_pollset_poll(ap
         pollset_lock_rings();
 
         for (i = 0, j = 0; i < nget; i++) {
-            fp = (((pfd_elem_t*)(pollset->p->port_set[i].portev_user))->pfd);
+            ep = (pfd_elem_t *)pollset->p->port_set[i].portev_user;
             if ((pollset->flags & APR_POLLSET_WAKEABLE) &&
-                fp.desc_type == APR_POLL_FILE &&
-                fp.desc.f == pollset->wakeup_pipe[0]) {
+                ep->pfd.desc_type == APR_POLL_FILE &&
+                ep->pfd.desc.f == pollset->wakeup_pipe[0]) {
                 apr_poll_drain_wakeup_pipe(pollset->wakeup_pipe);
                 rv = APR_EINTR;
             }
             else {
-                pollset->p->result_set[j] = fp;            
+                pollset->p->result_set[j] = ep->pfd;
                 pollset->p->result_set[j].rtnevents =
                     get_revent(pollset->p->port_set[i].portev_events);
-
-                /* If the ring element is still on the query ring, move it
-                 * to the add ring for re-association with the event port
-                 * later.  (It may have already been moved to the dead ring
-                 * by a call to pollset_remove on another thread.)
-                 */
-                ep = (pfd_elem_t *)pollset->p->port_set[i].portev_user;
-                if (ep->on_query_ring) {
-                    APR_RING_REMOVE(ep, link);
-                    ep->on_query_ring = 0;
-                    APR_RING_INSERT_TAIL(&(pollset->p->add_ring), ep,
-                                         pfd_elem_t, link);
-                }
                 j++;
             }
+            /* If the ring element is still on the query ring, move it
+             * to the add ring for re-association with the event port
+             * later.  (It may have already been moved to the dead ring
+             * by a call to pollset_remove on another thread.)
+             */
+            if (ep->on_query_ring) {
+                APR_RING_REMOVE(ep, link);
+                ep->on_query_ring = 0;
+                APR_RING_INSERT_TAIL(&(pollset->p->add_ring), ep,
+                                     pfd_elem_t, link);
+            }
         }
         pollset_unlock_rings();
         if ((*num = j)) { /* any event besides wakeup pipe? */



Mime
View raw message