|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Threading utilities (thread pools, worker pools, timed event queues) and synchronization helpers. More...
Files | |
| file | concurrency_utils.H |
| Modern synchronization helpers for channels, shared state, and small producer-consumer queues. | |
| file | experimental_async.H |
Opt-in experimental coroutine-friendly bridge over ThreadPool. | |
| file | thread_pool.H |
| A modern, efficient thread pool for parallel task execution. | |
| file | timeoutQueue.H |
| Priority queue for scheduling timed events. | |
| file | useCondVar.H |
| Legacy wrapper class for POSIX condition variables. | |
| file | useMutex.H |
| Legacy RAII-style wrapper for POSIX mutexes. | |
| file | worker_pool.H |
| General-purpose worker thread pool for parallel task execution. | |
Classes | |
| class | UseCondVar |
| Legacy wrapper class for POSIX condition variables. More... | |
| class | UseMutex |
| Legacy RAII-style mutex lock guard. More... | |
Functions | |
| UseCondVar::UseCondVar (pthread_cond_t *c, pthread_mutex_t *m) | |
| Construct wrapper for condition variable and mutex. | |
Threading utilities (thread pools, worker pools, timed event queues) and synchronization helpers.
This module groups Aleph-w facilities related to concurrency and thread-based execution.
It covers:
std::future.ThreadPool.parallel_invoke, pscan, pexclusive_scan, pmerge): foundational parallel building blocks for composing higher-level algorithms.void* work items.See thread_pool.H and the runnable example thread_pool_example.cc.
Typical usage pattern:
Structured task groups:
Cooperative cancellation:
Parallel algorithms can now be configured through ParallelOptions, including min_size, chunk_size, max_tasks, pool, and cancel_token.
This applies to the main helpers in ah-parallel.H, including map/filter/fold, parallel sort, scan/merge wrappers, zip, and enumerate operations. Existing ThreadPool& overloads remain available as compatibility wrappers.
If cancel_token is signaled and the algorithm observes it, the operation throws Aleph::operation_canceled.
Foundational building blocks now available in thread_pool.H:
Modern coordination helpers in concurrency_utils.H:
bounded_channel<T> also offers cancellation-aware blocking operations:
UseMutex and UseCondVar are still available for backward compatibility with older POSIX-style code, but new code should generally prefer concurrency_utils.H and standard C++ synchronization primitives.
See also the runnable example Examples/concurrency_utils_example.cc.
Work stealing was evaluated for this phase and intentionally deferred; see docs/work_stealing_backend_note.md for the design note and rationale.
See timeoutQueue.H and the runnable example timeoutQueue_example.C.
ThreadPool::enqueue()), but always check the specific header documentation.
|
inline |
Construct wrapper for condition variable and mutex.
| c | Pointer to initialized condition variable |
| m | Pointer to initialized mutex (must be held when waiting) |
| None |
Definition at line 129 of file useCondVar.H.
References UseCondVar::cond, m, and UseCondVar::mutex.