Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
UseCondVar Class Reference

Legacy wrapper class for POSIX condition variables. More...

#include <useCondVar.H>

Public Member Functions

 UseCondVar (pthread_cond_t *c, pthread_mutex_t *m)
 Construct wrapper for condition variable and mutex.
 
int wait ()
 Wait for the condition variable to be signaled.
 
int signal ()
 Signal one waiting thread.
 
int broadcast ()
 Wake all waiting threads.
 
 ~UseCondVar ()
 Destructor (does not destroy the condition variable)
 

Private Attributes

pthread_cond_t * cond
 
pthread_mutex_t * mutex
 

Detailed Description

Legacy wrapper class for POSIX condition variables.

Provides a simple interface for pthread condition variable operations. Does not own the condition variable or mutex - they must be managed separately. *

Deprecated:
Prefer std::condition_variable or Aleph::bounded_channel<T> in new code. Scheduled for removal no earlier than 5.0.0 (see VERSIONING.md).
Thread safety
Thread-safe only with external synchronization and correct mutex usage.

Definition at line 108 of file useCondVar.H.

Constructor & Destructor Documentation

◆ ~UseCondVar()

UseCondVar::~UseCondVar ( )
inline

Destructor (does not destroy the condition variable)

Definition at line 175 of file useCondVar.H.

Member Function Documentation

◆ broadcast()

int UseCondVar::broadcast ( )
inline

Wake all waiting threads.

Returns
0 on success, error code on failure *

Definition at line 168 of file useCondVar.H.

◆ signal()

int UseCondVar::signal ( )
inline

Signal one waiting thread.

Returns
0 on success, error code on failure *

Definition at line 156 of file useCondVar.H.

◆ wait()

int UseCondVar::wait ( )
inline

Wait for the condition variable to be signaled.

Returns
0 on success, error code on failure
Note
The mutex must be held when calling this function *

Definition at line 144 of file useCondVar.H.

Member Data Documentation

◆ cond

pthread_cond_t* UseCondVar::cond
private

Definition at line 114 of file useCondVar.H.

◆ mutex

pthread_mutex_t* UseCondVar::mutex
private

Definition at line 115 of file useCondVar.H.


The documentation for this class was generated from the following file: