|
rlib
Convenience library for useful things
|
Pool of worker threads sharing a common entry function; each worker is spawned with optional CPU-affinity placement. More...
#include <rlib/rtypes.h>#include <rlib/rref.h>#include <rlib/data/rbitset.h>#include <rlib/concurrency/rthreads.h>Go to the source code of this file.
Macros | |
| #define | r_thread_pool_ref r_ref_ref |
| Take a reference on the pool (alias for r_ref_ref). | |
| #define | r_thread_pool_unref r_ref_unref |
| Drop a reference on the pool (alias for r_ref_unref). | |
Typedefs | |
| typedef struct RThreadPool | RThreadPool |
| Opaque, refcounted thread-pool handle. | |
| typedef rpointer(* | RThreadPoolFunc) (rpointer common, rpointer specific) |
| Worker entry-point signature. | |
Functions | |
| RThreadPool * | r_thread_pool_new (const rchar *prefix, RThreadPoolFunc func, rpointer data) |
Create a new pool that will spawn workers running func. | |
| rboolean | r_thread_pool_start_thread (RThreadPool *pool, const rchar *name, const RBitset *affinity, rpointer data) |
| Spawn one worker with optional name and CPU-affinity mask. | |
| rboolean | r_thread_pool_start_thread_on_cpu (RThreadPool *pool, rsize cpuidx, rpointer data) |
| Spawn one worker pinned to a single CPU index. | |
| rboolean | r_thread_pool_start_thread_on_cpuset (RThreadPool *pool, const RBitset *cpuset, rpointer data) |
Spawn one worker whose affinity is the given cpuset. | |
| rboolean | r_thread_pool_start_thread_on_each_cpu (RThreadPool *pool, const RBitset *cpuset, rpointer data) |
Spawn one worker per CPU set in cpuset, each pinned to its respective CPU. | |
| void | r_thread_pool_join (RThreadPool *pool) |
Wait for all workers to finish; the pool must not be used for further _start_thread_* calls after this returns. | |
| ruint | r_thread_pool_running_threads (RThreadPool *pool) |
Return the number of workers currently running in pool. | |
Pool of worker threads sharing a common entry function; each worker is spawned with optional CPU-affinity placement.