Next: , Previous: , Up: Threads   [Contents][Index]

5.15.5 Mutual Exclusion Devices

Mutexes are lisp objects used to coordinate access to data shared across multiple threads (where interleaved access would be bad). These functions are exported by the rep.threads.mutex module (see Modules).

Function: make-mutex

Create and return a mutex object. No thread will own the new mutex.

Function: mutexp arg

Return true if arg is a mutex object.

Function: obtain-mutex mutex

Obtain the mutex mutex for the current thread. Will suspend the current thread until the mutex is exclusively available.

Function: maybe-obtain-mutex mutex

Attempt to obtain mutex mutex for the current thread without blocking. Returns true if able to obtain the mutex, false otherwise.

Function: release-mutex mutex

Release the mutex object mutex (which must have previously been obtained by the current thread). Returns true if the mutex has no new owner.