cgv
Loading...
Searching...
No Matches
cgv::os::condition_mutex Struct Reference

A mutex that can wake up other threads by signals sent when a condition is fulfilled. More...

#include <mutex.h>

Inheritance diagram for cgv::os::condition_mutex:
cgv::os::mutex

Public Member Functions

 condition_mutex ()
 construct a mutex
 
 ~condition_mutex ()
 destruct a mutex
 
void send_signal ()
 send the signal to unblock a thread waiting for the condition represented by this condition_mutex
 
void send_signal_with_lock ()
 prefered approach to send the signal and implemented as {lock();send_signal();unlock();}
 
void broadcast_signal ()
 broadcast signal to unblock several threads waiting for the condition represented by this condition_mutex
 
void broadcast_signal_with_lock ()
 prefered approach to broadcast the signal and implemented as {lock();broadcast_signal();unlock();}
 
- Public Member Functions inherited from cgv::os::mutex
 mutex ()
 construct a mutex
 
 ~mutex ()
 destruct a mutex
 
bool try_lock ()
 try to lock the mutex (return false if the mutex is still locked)
 
void lock ()
 lock the mutex (if the mutex is already locked, the caller is blocked until the mutex becomes available)
 
void unlock ()
 unlock the mutex
 
void debug_lock (const std::string &info)
 same as lock but with printing debug information
 
void debug_unlock (const std::string &info)
 same unlock but with printing debug information
 

Protected Attributes

void * pcond
 
- Protected Attributes inherited from cgv::os::mutex
void * pmutex
 

Friends

class thread
 

Additional Inherited Members

- Static Public Member Functions inherited from cgv::os::mutex
static unsigned get_debug_lock_counter ()
 return the global locking counter that is used for mutex debugging
 

Detailed Description

A mutex that can wake up other threads by signals sent when a condition is fulfilled.

Definition at line 41 of file mutex.h.

Constructor & Destructor Documentation

◆ condition_mutex()

cgv::os::condition_mutex::condition_mutex ( )

construct a mutex

Definition at line 80 of file mutex_pthread.h.

◆ ~condition_mutex()

cgv::os::condition_mutex::~condition_mutex ( )

destruct a mutex

Definition at line 86 of file mutex_pthread.h.

Member Function Documentation

◆ broadcast_signal()

void cgv::os::condition_mutex::broadcast_signal ( )

broadcast signal to unblock several threads waiting for the condition represented by this condition_mutex

Definition at line 106 of file mutex_pthread.h.

Referenced by broadcast_signal_with_lock().

◆ broadcast_signal_with_lock()

void cgv::os::condition_mutex::broadcast_signal_with_lock ( )

prefered approach to broadcast the signal and implemented as {lock();broadcast_signal();unlock();}

Definition at line 112 of file mutex_pthread.h.

References broadcast_signal(), cgv::os::mutex::lock(), and cgv::os::mutex::unlock().

◆ send_signal()

void cgv::os::condition_mutex::send_signal ( )

send the signal to unblock a thread waiting for the condition represented by this condition_mutex

Definition at line 92 of file mutex_pthread.h.

Referenced by send_signal_with_lock().

◆ send_signal_with_lock()

void cgv::os::condition_mutex::send_signal_with_lock ( )

prefered approach to send the signal and implemented as {lock();send_signal();unlock();}

Definition at line 98 of file mutex_pthread.h.

References cgv::os::mutex::lock(), send_signal(), and cgv::os::mutex::unlock().

Friends And Related Symbol Documentation

◆ thread

friend class thread
friend

Definition at line 45 of file mutex.h.

Member Data Documentation

◆ pcond

void* cgv::os::condition_mutex::pcond
protected

Definition at line 44 of file mutex.h.


The documentation for this struct was generated from the following files: