diff options
author | Yann Ylavic <ylavic@apache.org> | 2018-01-02 18:06:42 +0000 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2018-01-02 18:06:42 +0000 |
commit | 1b34c6f04f818eb3ec2bcb99b357f2cbe85d9d13 (patch) | |
tree | 4c9a24954b89c38e2b8379aca9ba4d3526936e82 /poll | |
parent | 20ac05a4870a1ec86b38e7f0c20b9212cb511bc1 (diff) | |
download | apr-1b34c6f04f818eb3ec2bcb99b357f2cbe85d9d13.tar.gz |
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.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1819860 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poll')
-rw-r--r-- | poll/unix/port.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/poll/unix/port.c b/poll/unix/port.c index 8e2894f48..b33c9b0ee 100644 --- a/poll/unix/port.c +++ b/poll/unix/port.c @@ -354,8 +354,9 @@ static apr_status_t impl_pollset_poll(apr_pollset_t *pollset, 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(apr_pollset_t *pollset, 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(apr_pollset_t *pollset, 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(apr_pollset_t *pollset, } } - 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); |