mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-30 11:13:57 +00:00
replace defer with try ... finally (#17753)
This commit is contained in:
@@ -47,9 +47,9 @@ proc release*(lock: var RLock) =
|
||||
|
||||
template withRLock*(lock: var RLock, code: untyped): untyped =
|
||||
## Acquires the given lock and then executes the code.
|
||||
block:
|
||||
acquire(lock)
|
||||
defer:
|
||||
release(lock)
|
||||
{.locks: [lock].}:
|
||||
acquire(lock)
|
||||
{.locks: [lock].}:
|
||||
try:
|
||||
code
|
||||
finally:
|
||||
release(lock)
|
||||
|
||||
Reference in New Issue
Block a user