Scopira  20080306
scopira::tool::condition Class Reference

#include <thread_pthreads.h>

Public Member Functions

 condition (void)
 
 ~condition ()
 non virtual dtor
 
void notify (void)
 
void notify_all (void)
 
void wait (mutex &mut)
 
bool wait (mutex &mut, int msec)
 
 condition (void)
 
 ~condition ()
 non virtual dtor
 
void notify (void)
 
void notify_all (void)
 
void wait (mutex &mut)
 
bool wait (mutex &mut, int msec)
 

Protected Attributes

pthread_cond_t dm_con
 
QWaitCondition dm_con
 

Detailed Description

A condition (short for ‘‘condition variable’’) is a synchronization device that allows threads to suspend execution and relinquish the pro- cessors until some predicate on shared data is satisfied. The basic operations on conditions are: signal the condition (when the predicate becomes true), and wait for the condition, suspending the thread execu- tion until another thread signals the condition.

Author
Aleksander Demko

Constructor & Destructor Documentation

◆ condition() [1/2]

scopira::tool::condition::condition ( void  )

constructor

◆ condition() [2/2]

scopira::tool::condition::condition ( void  )

constructor

Member Function Documentation

◆ notify() [1/2]

void scopira::tool::condition::notify ( void  )

Notify One waiting thread You don't need to do any mutex locking for this.

Author
Aleksander Demko

Referenced by scopira::tool::event_ptr< T >::notify().

◆ notify() [2/2]

void scopira::tool::condition::notify ( void  )

Notify One waiting thread You don't need to do any mutex locking for this.

Author
Aleksander Demko

◆ notify_all() [1/2]

void scopira::tool::condition::notify_all ( void  )

Notify ALL the waiting threads. You don't need to do any mutex locking for this.

Author
Aleksander Demko

Referenced by scopira::tool::event_ptr< T >::notify_all().

◆ notify_all() [2/2]

void scopira::tool::condition::notify_all ( void  )

Notify ALL the waiting threads. You don't need to do any mutex locking for this.

Author
Aleksander Demko

◆ wait() [1/4]

void scopira::tool::condition::wait ( mutex mut)

Waits, indefinatly for a notification. You must have a lock on the given mutex before calling this method. The method does a quick unlock before waiting, and reaquires the lock on notification.

Author
Aleksander Demko

Referenced by scopira::tool::event_ptr< T >::wait().

◆ wait() [2/4]

void scopira::tool::condition::wait ( mutex mut)

Waits, indefinatly for a notification. You must have a lock on the given mutex before calling this method. The method does a quick unlock before waiting, and reaquires the lock on notification.

Author
Aleksander Demko

◆ wait() [3/4]

bool scopira::tool::condition::wait ( mutex mut,
int  msec 
)

Waits, indefinatly for a notification. You must have a lock on the given mutex before calling this method. The method does a quick unlock before waiting, and reaquires the lock on notification.

Parameters
mutthe mutex that has been locked on entry
msecthe number of msec (1000=second) to wait
Returns
true if timed out, false if got a notification event
Author
Aleksander Demko

◆ wait() [4/4]

bool scopira::tool::condition::wait ( mutex mut,
int  msec 
)

Waits, indefinatly for a notification. You must have a lock on the given mutex before calling this method. The method does a quick unlock before waiting, and reaquires the lock on notification.

Parameters
mutthe mutex that has been locked on entry
msecthe number of msec (1000=second) to wait
Returns
true if timed out, false if got a notification event
Author
Aleksander Demko

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