locks

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

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

プロシージャ

proc initLock(lock: var Lock) {...}{.inline, raises: [], tags: [].}
Initializes the given lock.   ソース 編集
proc deinitLock(lock: var Lock) {...}{.inline, raises: [], tags: [].}
Frees the resources associated with the lock.   ソース 編集
proc tryAcquire(lock: var Lock): bool {...}{.raises: [], tags: [].}
Tries to acquire the given lock. Returns true on success.   ソース 編集
proc acquire(lock: var Lock) {...}{.raises: [], tags: [].}
Acquires the given lock.   ソース 編集
proc release(lock: var Lock) {...}{.raises: [], tags: [].}
Releases the given lock.   ソース 編集
proc initCond(cond: var Cond) {...}{.inline, raises: [], tags: [].}
Initializes the given condition variable.   ソース 編集
proc deinitCond(cond: var Cond) {...}{.inline, raises: [], tags: [].}
Frees the resources associated with the lock.   ソース 編集
proc wait(cond: var Cond; lock: var Lock) {...}{.inline, raises: [], tags: [].}
waits on the condition variable cond.   ソース 編集
proc signal(cond: var Cond) {...}{.inline, raises: [], tags: [].}
sends a signal to the condition variable cond.   ソース 編集

テンプレート

template withLock(a: Lock; body: untyped)
Acquires the given lock, executes the statements in body and releases the lock after the statements finish executing.   ソース 編集