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

Glib::Mutex::Lock Class Reference
[Threads]

#include <thread.h>

List of all members.


Detailed Description

Utility class for exception-safe mutex locking.
Usage example:
 {
   Glib::Mutex::Lock lock (mutex); // calls mutex.lock()
   do_something();
 } // the destructor calls mutex.unlock()
As you can see, the compiler takes care of the unlocking. This is not only exception safe but also much less error-prone. You could even return while still holding the lock and it will be released properly.

Definition at line 426 of file thread.h.


Public Member Functions

void acquire ()
 Lock (Mutex &mutex, TryLock)
 Lock (Mutex &mutex, NotLock)
 Lock (Mutex &mutex)
bool locked () const
void release ()
bool try_acquire ()

Private Member Functions

 Lock (const Mutex::Lock &)
Mutex::Lockoperator= (const Mutex::Lock &)

Private Attributes

bool locked_
Mutexmutex_

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

Generated by  Doxygen 1.6.0   Back to index