# std/rlocks

Theme:

- Manual
- Standard library
- Index
- Compiler docs
- Fusion docs
- devel, stable

Search:
Source Edit

This module contains Nim's support for reentrant locks.

# Imports

syslocks

# Types

    RLock = SysLock

  Nim lock, re-entrant Source Edit

# Procs

    proc acquire(lock: var RLock) {.inline, ...raises: [], tags: [], forbids: [].}

  Acquires the given lock. Source Edit

    proc deinitRLock(lock: RLock) {.inline, ...raises: [], tags: [], forbids: [].}

  Frees the resources associated with the lock. Source Edit

    proc initRLock(lock: var RLock) {.inline, ...raises: [], tags: [], forbids: [].}

  Initializes the given lock. Source Edit

    proc release(lock: var RLock) {.inline, ...raises: [], tags: [], forbids: [].}

  Releases the given lock. Source Edit

    proc tryAcquire(lock: var RLock): bool {.inline, ...raises: [], tags: [],
        forbids: [].}

  Tries to acquire the given lock. Returns `true` on success. Source Edit

# Templates

    template withRLock(lock: RLock; code: untyped)

  Acquires the given lock and then executes the code. Source Edit