Documentation for withLock.
This commit is contained in:
parent
1cc1a7faf4
commit
34401a3639
1 changed files with 2 additions and 0 deletions
|
|
@ -56,6 +56,8 @@ proc signal*(cond: var Cond) {.inline.} =
|
||||||
signalSysCond(cond)
|
signalSysCond(cond)
|
||||||
|
|
||||||
template withLock*(a: Lock, body: untyped) =
|
template withLock*(a: Lock, body: untyped) =
|
||||||
|
## Acquires the given lock, executes the statements in body and
|
||||||
|
## releases the lock after the statements finish executing.
|
||||||
a.acquire()
|
a.acquire()
|
||||||
{.locks: [a].}:
|
{.locks: [a].}:
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue