Method

GLibMutextrylock

Declaration

gboolean
g_mutex_trylock (
  GMutex* mutex
)

Description

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

GMutex is neither guaranteed to be recursive nor to be non-recursive. As such, calling g_mutex_lock() on a GMutex that has already been locked by the same thread results in undefined behaviour (including but not limited to deadlocks or arbitrary return values).

Return value

Returns: gboolean
 

TRUE if mutex could be locked.