int max_queue_size;
int num_queued;
- int can_read_detail;
fr_fifo_t *fifo[NUM_FIFOS];
} THREAD_POOL;
return 0;
}
- /*
- * We've added an entry that didn't come from the detail
- * file. Note that the child thread should signal the
- * main worker thread again when the queue becomes empty.
- */
- if (request->listener->type != RAD_LISTEN_DETAIL) {
- thread_pool.can_read_detail = FALSE;
- }
-
thread_pool.num_queued++;
pthread_mutex_unlock(&thread_pool.queue_mutex);
* Loop forever, until told to exit.
*/
do {
- int can_read_detail;
-
/*
* Wait to be signalled.
*/
pthread_mutex_lock(&thread_pool.queue_mutex);
rad_assert(thread_pool.active_threads > 0);
thread_pool.active_threads--;
-
- /*
- * If we're not currently allowed to read the
- * detail file, AND there are no requests queued,
- * THEN signal the main worker thread that
- * there's at least one waiting thread (us) who
- * can accept a packet from the detail file.
- */
- can_read_detail = FALSE;
- if (!thread_pool.can_read_detail &&
- (thread_pool.num_queued == 0)) {
- can_read_detail = TRUE;
- }
-
pthread_mutex_unlock(&thread_pool.queue_mutex);
-
- /*
- * Do this out of the lock to be nice to everyone.
- */
- if (can_read_detail) {
- radius_signal_self(RADIUS_SIGNAL_SELF_DETAIL);
- }
-
} while (self->status != THREAD_CANCELLED);
DEBUG2("Thread %d exiting...", self->thread_num);