This module implements readers-writer locks.
Procs
proc acquireRead(rw: var Rwlock) {.inline, ...raises: [], tags: [].}
- Acquires the given lock for reading. Source Edit
proc acquireWrite(rw: var Rwlock) {.inline, ...raises: [], tags: [].}
- Acquires the given lock for writing. Source Edit
proc deinitLock(rw: var Rwlock) {.inline, ...raises: [], tags: [].}
- Source Edit
proc releaseRead(rw: var Rwlock) {.inline, ...raises: [], tags: [].}
- Releases the given lock from reading. Source Edit
proc releaseWrite(rw: var Rwlock) {.inline, ...raises: [], tags: [].}
- Releases the given lock from writing. Source Edit
proc tryAcquireRead(rw: var Rwlock): bool {.inline, ...raises: [], tags: [].}
- Tries to acquire the given lock for reading. Returns true on success. Source Edit
proc tryAcquireWrite(rw: var Rwlock): bool {.inline, ...raises: [], tags: [].}
- Tries to acquire the given lock for writing. Returns true on success. Source Edit
Templates
template withReadLock(rw: Rwlock; stmt: untyped)
- Acquires the given lock for reading, executes the statements in body and releases the lock after the statements finish executing. Source Edit
template withWriteLock(rw: Rwlock; stmt: untyped)
- Acquires the given lock for writing, executes the statements in body and releases the lock after the statements finish executing. Source Edit