logo top
Main Page   Widgets   Namespaces   Book  

Glib::Mutex Class Reference

Represents a mutex (mutual exclusion). More...

List of all members.

Public Methods

 Mutex ()
 ~Mutex ()
void lock ()
 Locks the mutex.

bool trylock ()
 Tries to lock the mutex.

void unlock ()
 Unlocks the mutex.

GMutex* gobj ()

Detailed Description

Represents a mutex (mutual exclusion).

It can be used to protect data against shared access. Try to use Mutex::Lock instead of calling lock() and unlock() directly -- it will make your life much easier.

Before creating a Glib::Mutex, Glib::thread_init() has to be called.

Glib::Mutex is not recursive, i.e. a thread will deadlock, if it already has locked the mutex while calling lock(). Use Glib::RecMutex instead, if you need recursive mutexes.



Constructor & Destructor Documentation

Glib::Mutex::Mutex (  

Glib::Mutex::~Mutex (  

Member Function Documentation

GMutex* Glib::Mutex::gobj (   [inline]

void Glib::Mutex::lock (  

Locks the mutex.

If mutex is already locked by another thread, the current thread will block until mutex is unlocked by the other thread.

See also:

bool Glib::Mutex::trylock (  

Tries to lock the mutex.

If the mutex is already locked by another thread, it immediately returns false. Otherwise it locks the mutex and returns true.

Whether the mutex could be locked.
See also:

void Glib::Mutex::unlock (  

Unlocks the mutex.

If another thread is blocked in a lock() call for this mutex, it will be woken and can lock the mutex itself.

See also:

The documentation for this class was generated from the following file:
Generated for gtkmm by Doxygen 1.3-rc1 © 1997-2001