libhatchet
Loading...
Searching...
No Matches
hxcondition_variable Class Reference

#include <hxthread.hpp>

Public Member Functions

 hxcondition_variable (void)
 ~hxcondition_variable (void)
bool wait (hxmutex &mutex_)
bool wait (hxunique_lock &lock_)
template<typename callable_t_>
void wait (hxunique_lock &lock_, callable_t_ &&callable_)
bool notify_one (void)
bool notify_all (void)
inline::cnd_t * native_handle (void)

Detailed Description

hxcondition_variable - std::condition_variable style condition variable wrapper for the configured thread backend.

Allows threads to wait for notifications.

Constructor & Destructor Documentation

◆ hxcondition_variable()

hxcondition_variable::hxcondition_variable ( void )
inline

Constructs and initializes the condition variable.

◆ ~hxcondition_variable()

hxcondition_variable::~hxcondition_variable ( void )
inline

Destroys the condition variable if valid.

Member Function Documentation

◆ native_handle()

inline::cnd_t * hxcondition_variable::native_handle ( void )
inline

Returns a pointer to the native condition variable handle.

◆ notify_all()

bool hxcondition_variable::notify_all ( void )
inline

Notifies all waiting threads. Returns true on success, false otherwise.

◆ notify_one()

bool hxcondition_variable::notify_one ( void )
inline

Notifies one waiting thread. Returns true on success, false otherwise.

◆ wait() [1/3]

bool hxcondition_variable::wait ( hxmutex & mutex_)
inline

Waits for the condition variable to be notified.

Returns true on success, false otherwise. Callers must check the return value to confirm the wait succeeded.

  • mutex : The mutex to use for waiting.

◆ wait() [2/3]

bool hxcondition_variable::wait ( hxunique_lock & lock_)
inline

Overload: Waits using a hxunique_lock.

Returns true on success, false otherwise. Callers must check the return value to confirm the wait succeeded.

  • lock : The unique lock to use for waiting.

◆ wait() [3/3]

template<typename callable_t_>
void hxcondition_variable::wait ( hxunique_lock & lock_,
callable_t_ && callable_ )
inline

Waits until the predicate returns true.

  • lock : The unique lock to use for waiting.
  • callable : Predicate function to check.

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