No matching definitions.

tur/mutex

stdlib/mutex.tur

POSIX mutex (pthread_mutex_t) wrapped as ptr<void>.

Since: Phase T19-C

defn

mutex-new

(mutex-new :ptr<void>)

allocate and initialise a new POSIX mutex.

An opaque ptr<void> handle to a heap-allocated pthread_mutex_t.

(let [m (mutex-new)] ...)  ; => ptr<void>

Since: Phase T19-C

defn

mutex-lock

(mutex-lock [m :ptr<void>] :nil)

acquire the mutex, blocking until it is available.

mmutex handle returned by mutex-new
(mutex-lock m)

Since: Phase T19-C

defn

mutex-unlock

(mutex-unlock [m :ptr<void>] :nil)

release the mutex.

mmutex handle returned by mutex-new
(mutex-unlock m)

Since: Phase T19-C

defn

mutex-try-lock

(mutex-try-lock [m :ptr<void>] :bool)

attempt to acquire the mutex without blocking.

mmutex handle returned by mutex-new

true if the mutex was successfully acquired; false if it was already held.

(if (mutex-try-lock m) ...)  ; => bool

Since: Phase T19-C

defn

mutex-free

(mutex-free [m :ptr<void>] :nil)

destroy the mutex and release its memory.

mmutex handle returned by mutex-new
(mutex-free m)

Since: Phase T19-C