# std/rlocks

Dark Mode

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

Search:
Source Edit

This module contains Nim's support for reentrant locks.

# Types

    RLock = SysLock

  Nim lock, re-entrant Source Edit

# Procs

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

  Acquires the given lock. Source Edit

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

  Frees the resources associated with the lock. Source Edit

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

  Initializes the given lock. Source Edit

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

  Releases the given lock. Source Edit

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

  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