|
rlib
Convenience library for useful things
|
Atomics, threads, threadpools and task queues - the concurrency-flavoured building blocks the rest of rlib uses for thread-safe data structures, deferred work and parallel execution. More...
Modules | |
| Atomic operations | |
Sequentially-consistent load / store / exchange / CAS / fetch-modify operations on three atomic-friendly types (raint, rauint, raptr), plus a raboolean alias for the int variant. | |
| Task queue | |
| Deferred-work queue: callers enqueue RTask objects with optional dependencies, worker threads owned by the queue pick them up and run them to completion. | |
| Thread pool | |
Worker pool where every thread runs the same entry function with a shared common argument plus a per-thread specific argument. | |
| One-shot initialisation | |
| Run an init function exactly once across all threads, with a cheap fast path on every subsequent call. | |
| Threads, locks and condition variables | |
| OS-thread spawning, mutex / RW-mutex / condition-variable primitives, and thread-specific storage. | |
Atomics, threads, threadpools and task queues - the concurrency-flavoured building blocks the rest of rlib uses for thread-safe data structures, deferred work and parallel execution.
Four sub-areas:
r_atomic — atomic operations (load / store / CAS / fetch-add across the integer widths plus pointer types).r_threads — threads, mutexes, condition variables, TLS.r_threadpool — fixed- and dynamic-size thread pools backed by r_threads + a queue of r_taskqueue jobs.r_taskqueue — deferred-work queue with cancellation, priorities and per-task callbacks.Atomics underpin the refcount in r_ref and the hazard-pointer machinery in r_hzrptr, so the dependency direction is concurrency primitives -> data structures -> higher subsystems.