Multithreaded Programming Guide

thr_pool_create()

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);
min_threads

Minimum number of threads in the pool.

max_threads

Maximum number of threads in the pool.

linger

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.

attr

Attributes of all worker threads. This can be NULL.

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