port.c (apr-1.6.5.tar.bz2) | : | port.c (apr-1.7.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 358 | skipping to change at line 358 | |||
} | } | |||
static apr_status_t impl_pollset_poll(apr_pollset_t *pollset, | static apr_status_t impl_pollset_poll(apr_pollset_t *pollset, | |||
apr_interval_time_t timeout, | apr_interval_time_t timeout, | |||
apr_int32_t *num, | apr_int32_t *num, | |||
const apr_pollfd_t **descriptors) | const apr_pollfd_t **descriptors) | |||
{ | { | |||
apr_os_sock_t fd; | apr_os_sock_t fd; | |||
int ret; | int ret; | |||
unsigned int nget, i; | unsigned int nget, i; | |||
apr_int32_t nres = 0; | apr_int32_t j; | |||
pfd_elem_t *ep; | pfd_elem_t *ep; | |||
apr_status_t rv = APR_SUCCESS; | apr_status_t rv = APR_SUCCESS; | |||
*num = 0; | *num = 0; | |||
nget = 1; | nget = 1; | |||
pollset_lock_rings(); | pollset_lock_rings(); | |||
apr_atomic_inc32(&pollset->p->waiting); | apr_atomic_inc32(&pollset->p->waiting); | |||
skipping to change at line 408 | skipping to change at line 408 | |||
rv = call_port_getn(pollset->p->port_fd, pollset->p->port_set, | rv = call_port_getn(pollset->p->port_fd, pollset->p->port_set, | |||
pollset->nalloc, &nget, timeout); | pollset->nalloc, &nget, timeout); | |||
/* decrease the waiting ASAP to reduce the window for calling | /* decrease the waiting ASAP to reduce the window for calling | |||
port_associate within apr_pollset_add() */ | port_associate within apr_pollset_add() */ | |||
apr_atomic_dec32(&pollset->p->waiting); | apr_atomic_dec32(&pollset->p->waiting); | |||
pollset_lock_rings(); | pollset_lock_rings(); | |||
for (i = 0; i < nget; i++) { | for (i = 0, j = 0; i < nget; i++) { | |||
ep = (pfd_elem_t *)pollset->p->port_set[i].portev_user; | ep = (pfd_elem_t *)pollset->p->port_set[i].portev_user; | |||
if ((pollset->flags & APR_POLLSET_WAKEABLE) && | if ((pollset->flags & APR_POLLSET_WAKEABLE) && | |||
ep->pfd.desc_type == APR_POLL_FILE && | ep->pfd.desc_type == APR_POLL_FILE && | |||
ep->pfd.desc.f == pollset->wakeup_pipe[0]) { | ep->pfd.desc.f == pollset->wakeup_pipe[0]) { | |||
apr_poll_drain_wakeup_pipe(pollset->wakeup_pipe); | apr_poll_drain_wakeup_pipe(pollset->wakeup_pipe); | |||
rv = APR_EINTR; | rv = APR_EINTR; | |||
} | } | |||
else { | else { | |||
pollset->p->result_set[nres] = ep->pfd; | pollset->p->result_set[j] = ep->pfd; | |||
pollset->p->result_set[nres].rtnevents = | pollset->p->result_set[j].rtnevents = | |||
get_revent(pollset->p->port_set[i].portev_events); | get_revent(pollset->p->port_set[i].portev_events); | |||
++nres; | j++; | |||
} | } | |||
/* If the ring element is still on the query ring, move it | /* If the ring element is still on the query ring, move it | |||
* to the add ring for re-association with the event port | * to the add ring for re-association with the event port | |||
* later. (It may have already been moved to the dead ring | * later. (It may have already been moved to the dead ring | |||
* by a call to pollset_remove on another thread.) | * by a call to pollset_remove on another thread.) | |||
*/ | */ | |||
if (ep->on_query_ring) { | if (ep->on_query_ring) { | |||
APR_RING_REMOVE(ep, link); | APR_RING_REMOVE(ep, link); | |||
ep->on_query_ring = 0; | ep->on_query_ring = 0; | |||
APR_RING_INSERT_TAIL(&(pollset->p->add_ring), ep, | APR_RING_INSERT_TAIL(&(pollset->p->add_ring), ep, | |||
pfd_elem_t, link); | pfd_elem_t, link); | |||
} | } | |||
} | } | |||
if (nres > 0) { /* any event besides wakeup pipe? */ | if ((*num = j)) { /* any event besides wakeup pipe? */ | |||
*num = nres; | ||||
rv = APR_SUCCESS; | rv = APR_SUCCESS; | |||
if (descriptors) { | if (descriptors) { | |||
*descriptors = pollset->p->result_set; | *descriptors = pollset->p->result_set; | |||
} | } | |||
} | } | |||
/* Shift all PFDs in the Dead Ring to the Free Ring */ | /* 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); | APR_RING_CONCAT(&(pollset->p->free_ring), &(pollset->p->dead_ring), pfd_elem _t, link); | |||
pollset_unlock_rings(); | pollset_unlock_rings(); | |||
End of changes. 5 change blocks. | ||||
7 lines changed or deleted | 6 lines changed or added |