A no nonsense implementation of a thread pool in C using the pthreads library.
- Opaque thread pool handler
thpool_t - Create a new thread pool using
thpool_t *thpool_create(int size). ReturnsNULLon failure - Add an task using
int thpool_add(thpool_t *pool, void (*func)(void *), void *arg). Returns0on success,-1on failure. - Destroy the thread pool using
void thpool_destroy(thpool_t *pool). Clears the job queue, waits for threads to finish their work, and finally quits.