Logo Search packages:      
Sourcecode: ardour version File versions  Download package

Glib::Cond Class Reference
[Threads]

#include <thread.h>

List of all members.


Detailed Description

An opaque data structure to represent a condition. A Cond is an object that threads can block on, if they find a certain condition to be false. If other threads change the state of this condition they can signal the Cond, such that the waiting thread is woken up.
Usage example:
 Glib::Cond data_cond;
 Glib::Mutex data_mutex;
 void* current_data = NULL;
 
 void push_data (void* data)
 {
   data_mutex.lock();
   current_data = data;
   data_cond.signal();
   data_mutex.unlock();
 }
 
 void* pop_data ()
 {
   void* data;
 
   data_mutex.lock();
   while (!current_data)
       data_cond.wait(data_mutex);
   data = current_data;
   current_data = NULL;
   data_mutex.unlock();
   return data;
 }

Definition at line 642 of file thread.h.


Public Member Functions

void broadcast ()
GCond * gobj ()
void signal ()
bool timed_wait (Mutex &mutex, const Glib::TimeVal &abs_time)
void wait (Mutex &mutex)

Private Member Functions

 Cond (const Cond &)
Condoperator= (const Cond &)

Private Attributes

GCond * gobject_

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

Generated by  Doxygen 1.6.0   Back to index