No matching definitions.

tur/rwlock

stdlib/rwlock.tur

POSIX read-write lock (pthread_rwlock_t) wrapped as ptr<void>.

Since: Phase T19-C

defopaque

RwLock

(RwLock)
defn

rwlock-new

(rwlock-new :)

allocate and initialise a new POSIX read-write lock.

An RwLock handle to a heap-allocated pthread_rwlock_t.

(let [rw (rwlock-new)] ...)  ; => RwLock

Since: Phase T19-C

defn

rwlock-rdlock

(rwlock-rdlock [rw : RwLock] :)

acquire a shared read lock, blocking until available.

rwrwlock handle returned by rwlock-new
(rwlock-rdlock rw)

Since: Phase T19-C

defn

rwlock-wrlock

(rwlock-wrlock [rw : RwLock] :)

acquire an exclusive write lock, blocking until available.

rwrwlock handle returned by rwlock-new
(rwlock-wrlock rw)

Since: Phase T19-C

defn

rwlock-try-rdlock

(rwlock-try-rdlock [rw : RwLock] :)

attempt to acquire a shared read lock without blocking.

rwrwlock handle returned by rwlock-new

true if the read lock was acquired; false if a writer currently holds the lock.

(if (rwlock-try-rdlock rw) ...)  ; => bool

Since: Phase T19-C

defn

rwlock-try-wrlock

(rwlock-try-wrlock [rw : RwLock] :)

attempt to acquire an exclusive write lock without blocking.

rwrwlock handle returned by rwlock-new

true if the write lock was acquired; false if the lock is currently held.

(if (rwlock-try-wrlock rw) ...)  ; => bool

Since: Phase T19-C

defn

rwlock-unlock

(rwlock-unlock [rw : RwLock] :)

release a previously acquired read or write lock.

rwrwlock handle returned by rwlock-new
(rwlock-unlock rw)

Since: Phase T19-C

defn

rwlock-free

(rwlock-free [rw : RwLock] :)

destroy the read-write lock and release its memory.

rwrwlock handle returned by rwlock-new
(rwlock-free rw)

Since: Phase T19-C