Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Threads and Concurrency

Threading utilities (thread pools, worker pools, timed event queues) and synchronization helpers. More...

Files

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
 Wrapper class for POSIX condition variables.
 
file  useMutex.H
 RAII-style wrapper for POSIX mutexes.
 
file  worker_pool.H
 General-purpose worker thread pool for parallel task execution.
 

Classes

class  UseCondVar
 Wrapper class for POSIX condition variables. More...
 
class  UseMutex
 RAII-style mutex lock guard. More...
 

Functions

 UseCondVar::UseCondVar (pthread_cond_t *c, pthread_mutex_t *m)
 Construct wrapper for condition variable and mutex.
 

Detailed Description

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:

ThreadPool (task-based)

See thread_pool.H and the runnable example thread_pool_example.cc.

Typical usage pattern:

#include <thread_pool.H>
auto f = pool.enqueue([](int x) { return x * x; }, 5);
int v = f.get();
(void) v;
A reusable thread pool for efficient parallel task execution.
A modern, efficient thread pool for parallel task execution.

TimeoutQueue (timed events)

See timeoutQueue.H and the runnable example timeoutQueue_example.C.

Notes

Function Documentation

◆ UseCondVar()

UseCondVar::UseCondVar ( pthread_cond_t *  c,
pthread_mutex_t *  m 
)
inline

Construct wrapper for condition variable and mutex.

Precondition
c != nullptr && m != nullptr
Parameters
cPointer to initialized condition variable
mPointer to initialized mutex (must be held when waiting)
Exceptions
None
Complexity O(1)
Exception safety No-throw

Definition at line 122 of file useCondVar.H.

References UseCondVar::cond, and UseCondVar::mutex.