7.5.15.2 SRFI-18 Mutexes

SRFI-18 mutexes are disjoint from Guile’s primitive mutexes. See Mutexes and Condition Variables, for more on Guile’s primitive facility.

Function: make-mutex [name]

Returns a new mutex, optionally assigning it the object name name, which may be any Scheme object. The returned mutex will be created with the configuration described above.

Function: mutex-name mutex

Returns the name assigned to mutex at the time of its creation, or #f if it was not given a name.

Function: mutex-specific mutex

Return the “object-specific” property of mutex, or #f if none is set.

Function: mutex-specific-set! mutex obj

Set the “object-specific” property of mutex.

Function: mutex-state mutex

Returns information about the state of mutex. Possible values are:

  • thread t: the mutex is in the locked/owned state and thread t is the owner of the mutex
  • symbol not-owned: the mutex is in the locked/not-owned state
  • symbol abandoned: the mutex is in the unlocked/abandoned state
  • symbol not-abandoned: the mutex is in the unlocked/not-abandoned state
Function: mutex-lock! mutex [timeout [thread]]

Lock mutex, optionally specifying a time object timeout after which to abort the lock attempt and a thread thread giving a new owner for mutex different than the current thread.

Function: mutex-unlock! mutex [condition-variable [timeout]]

Unlock mutex, optionally specifying a condition variable condition-variable on which to wait, either indefinitely or, optionally, until the time object timeout has passed, to be signaled.