[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
7.5.15.2 SRFI-18 Mutexes
The behavior of Guile’s built-in mutexes is parameterized via a set of
flags passed to the make-mutex
procedure in the core
(see section Mutexes and Condition Variables). To satisfy the requirements
for mutexes specified by SRFI-18, the make-mutex
procedure
described below sets the following flags:
-
recursive
: the mutex can be locked recursively -
unchecked-unlock
: attempts to unlock a mutex that is already unlocked will not raise an exception -
allow-external-unlock
: the mutex can be unlocked by any thread, not just the thread that locked it originally
- 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. Note that the name
make-mutex
conflicts with Guile core functionmake-mutex
. Applications wanting to use both of these functions will need to refer to them by different names.
- 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
- Function: mutex-specific-set! mutex obj
Get or set the “object-specific” property of mutex. In Guile’s implementation of SRFI-18, this value is stored as an object property, and will be
#f
if not set.
- 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
-
thread
- 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. This procedure has the same behavior as the
lock-mutex
procedure in the core library.
- 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 signalled. This procedure has the same behavior as the
unlock-mutex
procedure in the core library.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on April 20, 2013 using texi2html 5.0.