Multithreaded Programming Guide


Enqueue a work request or task to the thread pool job queue.

int  thr_pool_queue(thr_pool_t *pool, void *(*func)(void *), void *arg);

A thread pool identifier returned from thr_pool_create().


The task function to be called.


The only argument passed to the task function.

On error, thr_pool_queue() returns -1 with errno set to the error code.

Notice the similarity of the func and arg arguments to the start_routine and arg arguments of pthread_create() shown in pthread_create Syntax. The thr_pool_queue() function can be used as a replacement for pthread_create() in existing applications. Note that if you use thr_pool_queue() instead of pthread_create(), you cannot use pthread_join() to wait for the task to complete.