StaticRecMutex

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

A #GStaticRecMutex works like a #GStaticMutex, but it can be locked multiple times by one thread. If you enter it n times, you have to unlock it n times again to let other threads lock it. An exception is the function g_static_rec_mutex_unlock_full(): that allows you to unlock a #GStaticRecMutex completely returning the depth, (i.e. the number of times this mutex was locked). The depth can later be used to restore the state of the #GStaticRecMutex by calling g_static_rec_mutex_lock_full(). In GLib 2.32, #GStaticRecMutex has been deprecated in favor of #GRecMutex.

Even though #GStaticRecMutex is not opaque, it should only be used with the following functions.

All of the g_static_rec_mutex_* functions can be used even if g_thread_init() has not been called. Then they do nothing, apart from g_static_rec_mutex_trylock(), which does nothing but returning true.

Constructors

Link copied to clipboard
constructor()

Allocate a new StaticRecMutex.

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

Allocate a new StaticRecMutex 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 glibStaticRecMutexPointer: <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
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
fun free()

Releases all resources allocated to a #GStaticRecMutex.

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

A #GStaticRecMutex must be initialized with this function before it can be used. Alternatively you can initialize it with %G_STATIC_REC_MUTEX_INIT.

Link copied to clipboard
fun lock()

Locks @mutex. If @mutex is already locked by another thread, the current thread will block until @mutex is unlocked by the other thread. If @mutex is already locked by the calling thread, this functions increases the depth of @mutex and returns immediately.

Link copied to clipboard
fun lockFull(depth: <Error class: unknown class>)

Works like calling g_static_rec_mutex_lock() for @mutex @depth times.

Link copied to clipboard

Tries to lock @mutex. If @mutex is already locked by another thread, it immediately returns false. Otherwise it locks @mutex and returns true. If @mutex is already locked by the calling thread, this functions increases the depth of @mutex and immediately returns true.

Link copied to clipboard
fun unlock()

Unlocks @mutex. Another thread will be allowed to lock @mutex only when it has been unlocked as many times as it had been locked before. If @mutex is completely unlocked and another thread is blocked in a g_static_rec_mutex_lock() call for @mutex, it will be woken and can lock @mutex itself.

Link copied to clipboard
fun unlockFull(): <Error class: unknown class>

Completely unlocks @mutex. If another thread is blocked in a g_static_rec_mutex_lock() call for @mutex, it will be woken and can lock @mutex itself. This function returns the number of times that