A scoped locking class for exception safe locking of GStaticRecMutex objects. More...
|GStaticRecMutex *||get () const|
|GrecmutexLock (GStaticRecMutex &mutex_)|
|GrecmutexLock (GStaticRecMutex &mutex_, Locked tag)|
A scoped locking class for exception safe locking of GStaticRecMutex objects.
It should be noted that this class is for use with GStaticRecMutex objects, and not the GRecMutex objects available in glib from glib version 2.32. If glib >= 2.32 is installed, it can be assumed that native recursive mutexes and so Cgu::Thread::RecMutex are available, as glib >= 2.32 also uses native recursive mutexes.
This constructor locks the mutex and acquires ownership, and blocks if it is already locked until it becomes free, unless the constructing thread already holds the lock, in which case it increments the lock count and returns immediately. It is not a cancellation point. It does not throw.
|mutex_||The mutex to be locked.|
This constructor takes an already locked mutex (say as a result of g_static_rec_mutex_trylock()), and takes ownership of it. It is not a cancellation point. It does not throw.
|mutex_||The mutex to be managed by this object.|
|tag||Pass the Cgu::Thread::locked enum tag to this parameter.|
The destructor unlocks the owned mutex, and either relinquishes ownership (if the mutex has not been recursively locked) or decrements the lock count (if it has). It is not a cancellation point. It does not throw.
This method provides access to the GStaticRecMutex object locked by this GrecmutexLock object. It does not throw. It is thread safe.