summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--poll/unix/port.c13
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);