18#ifndef __R_THREAD_POOL_H__
19#define __R_THREAD_POOL_H__
21#if !defined(__RLIB_H_INCLUDE_GUARD__) && !defined(RLIB_COMPILATION)
22#error "#include <rlib.h> only please."
81#define r_thread_pool_ref r_ref_ref
83#define r_thread_pool_unref r_ref_unref
#define R_API
Public-API decoration: resolves to R_API_EXPORT while building rlib and R_API_IMPORT for consumers.
Definition rmacros.h:115
#define R_BEGIN_DECLS
Open an extern "C" block under C++ (no-op in C).
Definition rmacros.h:196
ruint r_thread_pool_running_threads(RThreadPool *pool)
Return the number of workers currently running in pool.
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.
struct RThreadPool RThreadPool
Opaque, refcounted thread-pool handle.
Definition rthreadpool.h:60
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 thi...
rboolean r_thread_pool_start_thread_on_cpuset(RThreadPool *pool, const RBitset *cpuset, rpointer data)
Spawn one worker whose affinity is the given cpuset.
rpointer(* RThreadPoolFunc)(rpointer common, rpointer specific)
Worker entry-point signature.
Definition rthreadpool.h:67
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.
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_on_cpu(RThreadPool *pool, rsize cpuidx, rpointer data)
Spawn one worker pinned to a single CPU index.
char rchar
Default character type (char).
Definition rtypes.h:137
int rboolean
Boolean type (typedef'd to int).
Definition rtypes.h:59
unsigned int ruint
Unsigned int.
Definition rtypes.h:157
void * rpointer
Generic pointer (alias for void *).
Definition rtypes.h:327
unsigned long rsize
Unsigned pointer-sized size type (like size_t).
Definition rtypes.h:290
Fixed-width bitset with bit / byte / word accessors and bitwise compound operations.
Refcount base struct shared by every refcounted type in rlib.
Threads, mutexes (plain, recursive, read/write), condition variables, thread-specific storage and one...
Foundational type aliases used by every rlib header.
Fixed-width bitset.
Definition rbitset.h:68