RecMutex
Added in version 2.32.
- class RecMutex(*args, **kwargs)
- Constructors:
RecMutex()
Methods
- class RecMutex
- clear() None
Frees the resources allocated to a recursive mutex with
init()
.This function should not be used with a
RecMutex
that has been statically allocated.Calling
clear()
on a locked recursive mutex leads to undefined behaviour.Added in version 2.32.
- init() None
Initializes a
RecMutex
so that it can be used.This function is useful to initialize a recursive mutex that has been allocated on the stack, or as part of a larger structure.
It is not necessary to initialise a recursive mutex that has been statically allocated.
typedef struct { GRecMutex m; ... } Blob; Blob *b; b = g_new (Blob, 1); g_rec_mutex_init (&b->m);
Calling
init()
on an already initializedRecMutex
leads to undefined behaviour.To undo the effect of
init()
when a recursive mutex is no longer needed, useclear()
.Added in version 2.32.
- lock() None
Locks
rec_mutex
. Ifrec_mutex
is already locked by another thread, the current thread will block untilrec_mutex
is unlocked by the other thread. Ifrec_mutex
is already locked by the current thread, the ‘lock count’ ofrec_mutex
is increased. The mutex will only become available again when it is unlocked as many times as it has been locked.Added in version 2.32.