C Collections

cthreadpool · Section 3

cthrpool_create

cthrpool_create - create a thread pool with default memory management

C Collections (libccollections, -lccollections)

#include <ccollections/cthreadpool.h>
 
cthrpool cthrpool_create(size_t num_threads,
                         size_t queue_capacity,
                         char **err_str);

A wrapper around cthrpool_create_mp with mprocs = NULL, so the pool uses
the standard malloc and free for every allocation it makes.

num_threads    Number of worker threads (must be >= 1)
queue_capacity 0 for unbounded; N > 0 for bounded. ccol_invalid_size
               is refused (see cthrpool_create_mp(3)).
err_str        Optional. It gets a static error string on failure

Returns a new cthrpool handle on success, or CTHRPOOL_NULL on failure.
A process with no thread-specific key left to give gets CTHRPOOL_NULL
from this call and from every later one; see cthrpool_create_mp(3).

cthrpool_create_mp(3), cthrpool_construct(3)