apr-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=1819860&view=rev
Log:
poll, port: no need to release and re-acquire the lock in between walking the
pollset and handling the dead ring, all is simple/fast/nonblocking ops.

Also, set types of "i" and "j" respectively to the ones of nget and *num.


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=1819860&r1=1819859&r2=1819860&view=diff
==============================================================================
--- apr/apr/trunk/poll/unix/port.c (original)
+++ apr/apr/trunk/poll/unix/port.c Tue Jan  2 18:06:42 2018
@@ -354,8 +354,9 @@ static apr_status_t impl_pollset_poll(ap
                                       const apr_pollfd_t **descriptors)
 {
     apr_os_sock_t fd;
-    int ret, i, j;
-    unsigned int nget;
+    int ret;
+    unsigned int nget, i;
+    apr_int32_t j;
     pfd_elem_t *ep;
     apr_status_t rv = APR_SUCCESS;
 
@@ -403,10 +404,9 @@ static apr_status_t impl_pollset_poll(ap
        port_associate within apr_pollset_add() */
     apr_atomic_dec32(&pollset->p->waiting);
 
-    if (nget) {
-
-        pollset_lock_rings();
+    pollset_lock_rings();
 
+    if (nget) {
         for (i = 0, j = 0; i < nget; i++) {
             ep = (pfd_elem_t *)pollset->p->port_set[i].portev_user;
             if ((pollset->flags & APR_POLLSET_WAKEABLE) &&
@@ -433,7 +433,6 @@ static apr_status_t impl_pollset_poll(ap
                                      pfd_elem_t, link);
             }
         }
-        pollset_unlock_rings();
         if ((*num = j)) { /* any event besides wakeup pipe? */
             rv = APR_SUCCESS;
             if (descriptors) {
@@ -442,8 +441,6 @@ static apr_status_t impl_pollset_poll(ap
         }
     }
 
-    pollset_lock_rings();
-
     /* Shift all PFDs in the Dead Ring to the Free Ring */
     APR_RING_CONCAT(&(pollset->p->free_ring), &(pollset->p->dead_ring),
pfd_elem_t, link);
 



Mime
View raw message