Changes with Apache 2.0.26-dev
+ *) Turn the worker MPM's queue into a LIFO. This may
+ improve cache-hit performance under some conditions.
+ [Aaron Bannert <aaron@clove.org>]
+
*) Switch back to SIGUSR1 for graceful restarts on all platforms that
support it. [Justin Erenkrantz]
*/
static int ap_queue_empty(fd_queue_t *queue)
{
- /*return (queue->head == queue->tail);*/
return (queue->blanks >= queue->bounds - 1);
}
return FD_QUEUE_FAILURE;
bounds = queue_capacity + 1;
- queue->head = queue->tail = 0;
+ queue->tail = 0;
queue->data = apr_palloc(a, bounds * sizeof(fd_queue_elem_t));
queue->bounds = bounds;
queue->blanks = queue_capacity;
queue->data[queue->tail].sd = sd;
queue->data[queue->tail].p = p;
- queue->tail = (queue->tail + 1) % queue->bounds;
+ queue->tail++;
queue->blanks--;
pthread_cond_signal(&queue->not_empty);
*/
apr_status_t ap_queue_pop(fd_queue_t *queue, apr_socket_t **sd, apr_pool_t **p)
{
+ fd_queue_elem_t *elem;
+
if (pthread_mutex_lock(&queue->one_big_mutex) != 0) {
return FD_QUEUE_FAILURE;
}
}
}
- *sd = queue->data[queue->head].sd;
- *p = queue->data[queue->head].p;
- queue->data[queue->head].sd = NULL;
- queue->data[queue->head].p = NULL;
- if (sd != NULL) {
- queue->head = (queue->head + 1) % queue->bounds;
- }
+ queue->tail--;
+ elem = &queue->data[queue->tail];
+ *sd = elem->sd;
+ *p = elem->p;
+ elem->sd = NULL;
+ elem->p = NULL;
queue->blanks++;
if (pthread_mutex_unlock(&queue->one_big_mutex) != 0) {