RecMutex

class RecMutex(pointer: <Error class: unknown class><<Error class: unknown class>>, cleaner: <Error class: unknown class>? = null) : ProxyInstance

The GRecMutex struct is an opaque data structure to represent a recursive mutex. It is similar to a #GMutex 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 #GRecMutex is allocated in static storage then it can be used without initialisation. Otherwise, you should call g_rec_mutex_init() on it and g_rec_mutex_clear() when done.

A GRecMutex should only be accessed with the g_rec_mutex_ functions.

Since

2.32

Constructors

Link copied to clipboard
constructor()

Allocate a new RecMutex.

constructor(scope: <Error class: unknown class>)

Allocate a new RecMutex using the provided AutofreeScope.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>, cleaner: <Error class: unknown class>? = null)

Properties

Link copied to clipboard
val glibRecMutexPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open override val handle: <Error class: unknown class>?

Functions

Link copied to clipboard
fun clear()

Frees the resources allocated to a recursive mutex with g_rec_mutex_init().

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Compare two proxy instances for equality. This will compare both the type of the instances, and their memory addresses.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun init()

Initializes a #GRecMutex so that it can be used.

Link copied to clipboard
fun 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.

Link copied to clipboard

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.

Link copied to clipboard
fun unlock()

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