Documentation for withLock.

This commit is contained in:
Dominik Picheta
2016-03-23 12:47:05 +00:00
parent 1cc1a7faf4
commit 34401a3639

View File

@@ -56,6 +56,8 @@ proc signal*(cond: var Cond) {.inline.} =
signalSysCond(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.
a.acquire()
{.locks: [a].}:
try: