} recycled_pool;
struct fd_queue_info_t {
- apr_uint32_t idlers;
+ volatile apr_uint32_t idlers;
apr_thread_mutex_t *idlers_mutex;
apr_thread_cond_t *wait_for_idler;
int terminated;
apr_pool_t *pool_to_recycle)
{
apr_status_t rv;
- int prev_idlers;
/* If we have been given a pool to recycle, atomically link
* it into the queue_info's list of recycled pools
}
}
- /* Atomically increment the count of idle workers */
- for (;;) {
- prev_idlers = queue_info->idlers;
- if (apr_atomic_cas32(&(queue_info->idlers), prev_idlers + 1,
- prev_idlers) == prev_idlers) {
- break;
- }
- }
-
- /* If this thread just made the idle worker count nonzero,
+ /* If this thread makes the idle worker count nonzero,
* wake up the listener. */
- if (prev_idlers == 0) {
+ if (apr_atomic_inc32(&queue_info->idlers) == 0) {
rv = apr_thread_mutex_lock(queue_info->idlers_mutex);
if (rv != APR_SUCCESS) {
return rv;