#include <pthread.h>
#include <stdbool.h>
Go to the source code of this file.
◆ vud_pool
a simple thread pool implementation used for parallel memory accesses
◆ vud_pool_worker
| typedef void(* vud_pool_worker) (unsigned id, unsigned nr_worker, void *arg) |
called once per pool_do call for each worker
- Parameters
-
| id | ID of the worker - The id is between 0 and the worker count minus 1 |
| nr_worker | number of workers in the current pool |
| arg | argument passed via pool_do |
◆ vud_pool_do()
perform an operation on all workers of the pool
- Parameters
-
| pool | thread pool to perform operation with |
| worker | function pointer to the operation to perform |
| arg | argument passed to all worker threads |
◆ vud_pool_free()
free up all resources (including threads and locks) used for the pool
◆ vud_pool_init()
| vud_pool * vud_pool_init |
( |
unsigned |
n_worker | ) |
|
create a new thread pool
This will spawn n_worker - 1 threads in the background, which will immediately block on a barrier waiting for something to do.
- Parameters
-
| n_worker | number of workers in the pool |
- Returns
- a thread pool on success or NULL on failure