std/locks

  Source   Edit

This module contains Nim's support for locks and condition vars.

Types

Cond = SysCond
Nim condition variable   Source   Edit
Lock = SysLock
Nim lock; whether this is re-entrant or not is unspecified!   Source   Edit

Procs

proc `$`(lock: Lock): string {....raises: [], tags: [].}
  Source   Edit
proc acquire(lock: var Lock) {.inline, ...raises: [], tags: [].}
Acquires the given lock.   Source   Edit
proc broadcast(cond: var Cond) {.inline, ...raises: [], tags: [].}
Unblocks all threads currently blocked on the specified condition variable cond.   Source   Edit
proc deinitCond(cond: var Cond) {.inline, ...raises: [], tags: [].}
Frees the resources associated with the condition variable.   Source   Edit
proc deinitLock(lock: var Lock) {.inline, ...raises: [], tags: [].}
Frees the resources associated with the lock.   Source   Edit
proc initCond(cond: var Cond) {.inline, ...raises: [], tags: [].}
Initializes the given condition variable.   Source   Edit
proc initLock(lock: var Lock) {.inline, ...raises: [], tags: [].}
Initializes the given lock.   Source   Edit
proc release(lock: var Lock) {.inline, ...raises: [], tags: [].}
Releases the given lock.   Source   Edit
proc signal(cond: var Cond) {.inline, ...raises: [], tags: [].}
Sends a signal to the condition variable cond.   Source   Edit
proc tryAcquire(lock: var Lock): bool {.inline, ...raises: [], tags: [].}
Tries to acquire the given lock. Returns true on success.   Source   Edit
proc wait(cond: var Cond; lock: var Lock) {.inline, ...raises: [], tags: [].}
Waits on the condition variable cond.   Source   Edit

Templates

template withLock(a: Lock; body: untyped)
Acquires the given lock, executes the statements in body and releases the lock after the statements finish executing.   Source   Edit