RecMutex

The GRecMutex struct is an opaque data structure to represent a recursive mutex. It is similar to a glib.Mutex with the difference that it is possible to lock a GRecMutex multiple times in the same thread without deadlock. When doing so, care has to be taken to unlock the recursive mutex as often as it has been locked.

If a glib.RecMutex is allocated in static storage then it can be used without initialisation. Otherwise, you should call RecMutex.init on it and RecMutex.clear when done.

A GRecMutex should only be accessed with the g_rec_mutex_ functions.

Constructors

this
this(GRecMutex* gRecMutex, bool ownedRef)

Sets our main struct and passes it to the parent class.

Members

Functions

clear
void clear()

Frees the resources allocated to a recursive mutex with RecMutex.init.

getRecMutexStruct
GRecMutex* getRecMutexStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

init
void init()

Initializes a glib.RecMutex so that it can be used.

lock
void lock()

Locks rec_mutex. If rec_mutex is already locked by another thread, the current thread will block until rec_mutex is unlocked by the other thread. If rec_mutex is already locked by the current thread, the 'lock count' of rec_mutex is increased. The mutex will only become available again when it is unlocked as many times as it has been locked.

trylock
bool trylock()

Tries to lock rec_mutex. If rec_mutex is already locked by another thread, it immediately returns FALSE. Otherwise it locks rec_mutex and returns TRUE.

unlock
void unlock()

Unlocks rec_mutex. If another thread is blocked in a RecMutex.lock call for rec_mutex, it will become unblocked and can lock rec_mutex itself.

Variables

gRecMutex
GRecMutex* gRecMutex;

the main Gtk struct

Meta

Since

2.32