Mutex.trylock

Tries to lock mutex. If mutex is already locked by another thread, it immediately returns FALSE. Otherwise it locks mutex and returns TRUE. This function can be used even if g_thread_init() has not yet been called, and, in that case, will immediately return TRUE. Note GMutex is neither guaranteed to be recursive nor to be non-recursive, i.e. the return value of g_mutex_trylock() could be both FALSE or TRUE, if the current thread already has locked mutex. Use GStaticRecMutex, if you need recursive mutexes.

class Mutex
int
trylock
()

Return Value

Type: int

TRUE, if mutex could be locked.

Meta