Multithreaded Programming Guide


Creates a thread pool. More than one pool can be created.

typedef struct thr_pool thr_pool_t;	/* opaque to clients */

thr_pool_t *thr_pool_create(uint_t min_threads, uint_t max_threads,
                uint_t linger, pthread_attr_t *attr);

Minimum number of threads in the pool.


Maximum number of threads in the pool.


Number of seconds that idle threads can linger before exiting, when no tasks come in. The idle threads can only exit if they are extra threads, above the number of minimum threads.


Attributes of all worker threads. This can be NULL.

On error, thr_pool_create() returns NULL with errno set to the error code.