diff options
author | flywind <xzsflywind@gmail.com> | 2021-04-17 17:48:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-17 11:48:22 +0200 |
commit | 5c5f356347b15a82491c7f23e9bf2dd30a0c80f2 (patch) | |
tree | 5900b4a5a8d50c32be258a0abe02cf1529b59c83 /lib/core | |
parent | 7e94420847d2d18347410099e97195ddebe8b85f (diff) | |
download | Nim-5c5f356347b15a82491c7f23e9bf2dd30a0c80f2.tar.gz |
replace defer with try ... finally (#17753)
Diffstat (limited to 'lib/core')
-rw-r--r-- | lib/core/rlocks.nim | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/core/rlocks.nim b/lib/core/rlocks.nim index 27a9c5e60..f9224adb8 100644 --- a/lib/core/rlocks.nim +++ b/lib/core/rlocks.nim @@ -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) |