No matching definitions.

tur/concurrent

stdlib/concurrent.tur

stub concurrency types for linear resource tracking.

Since: Phase LT4

defstruct linear

MutexGuard

(defstruct MutexGuard :linear [mutex :ptr<void>])

a linear (exactly-once) RAII wrapper for a held mutex lock.

Since: LT4

defn

mutex-guard-lock

(mutex-guard-lock [mutex] :MutexGuard)

lock a mutex and return a MutexGuard RAII token.

mutexa ptr<void> pointing to a pthread_mutex_t.

A MutexGuard holding the locked mutex.

(let [guard (mutex-guard-lock my-mutex)] ...)

Since: LT4

defn

mutex-guard-unlock

(mutex-guard-unlock [guard : MutexGuard] :int)

release the mutex held by a MutexGuard.

guarda MutexGuard (by value; guard is consumed).

0 on success, error code from pthread_mutex_unlock otherwise.

(mutex-guard-unlock guard)  ; => 0

Since: LT4

defn

mutex-guard-valid?

(mutex-guard-valid? [guard : MutexGuard] :bool)

return true if the MutexGuard holds a non-NULL mutex.

guarda MutexGuard value.

true if the underlying mutex pointer is non-NULL.

(mutex-guard-valid? guard)  ; => true

Since: LT4