|
glibmm
2.41.2
|
Represents a mutex (mutual exclusion). More...
#include <glibmm/thread.h>
Classes | |
| class | Lock |
| Utility class for exception-safe mutex locking. More... | |
Public Member Functions | |
| Mutex () | |
| ~Mutex () | |
| void | lock () |
| Locks the mutex. More... | |
| bool | trylock () |
| Tries to lock the mutex. More... | |
| void | unlock () |
| Unlocks the mutex. More... | |
| GMutex* | gobj () |
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.
| Glib::Mutex::Mutex | ( | ) |
| Glib::Mutex::~Mutex | ( | ) |
|
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.
| 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.
| 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.
1.8.7