GME  13
apr_thread_pool.h File Reference

APR Thread Pool Library. More...

Go to the source code of this file.


Detailed Description

APR Thread Pool Library.

Remarks:
This library implements a thread pool using apr_thread_t. A thread pool is a set of threads that can be created in advance or on demand until a maximum number. When a task is scheduled, the thread pool will find an idle thread to handle the task. In case all existing threads are busy and the number of tasks in the queue is higher than the adjustable threshold, the pool will try to create a new thread to serve the task if the maximum number has not been reached. Otherwise, the task will be put into a queue based on priority, which can be valued from 0 to 255, with higher values being served first. If there are tasks with the same priority, the new task might be put at the top or at the bottom - it depends on which function is used to put the task.
There may be the case where the thread pool can use up to the maximum number of threads at peak load, but having those threads idle afterwards. A maximum number of idle threads can be set so that the extra idling threads will be terminated to save system resources.

Definition in file apr_thread_pool.h.