diff options
Diffstat (limited to 'lib/core/locks.nim')
-rw-r--r-- | lib/core/locks.nim | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/core/locks.nim b/lib/core/locks.nim index d865c78c5..42a3aec7b 100644 --- a/lib/core/locks.nim +++ b/lib/core/locks.nim @@ -23,12 +23,14 @@ type ## in preventDeadlocks-mode guarantees re-entrancy. TCond* = TSysCond ## Nim condition variable - FLock* = object of TEffect ## effect that denotes that some lock operation - ## is performed - FAquireLock* = object of FLock ## effect that denotes that some lock is - ## aquired - FReleaseLock* = object of FLock ## effect that denotes that some lock is - ## released + LockEffect* = object of RootEffect ## effect that denotes that some lock operation + ## is performed + AquireEffect* = object of LockEffect ## effect that denotes that some lock is + ## aquired + ReleaseEffect* = object of LockEffect ## effect that denotes that some lock is + ## released +{.deprecated: [FLock: LockEffect, FAquireLock: AquireEffect, + FReleaseLock: ReleaseEffect].} const noDeadlocks = defined(preventDeadlocks) @@ -58,7 +60,7 @@ proc deinitLock*(lock: var TLock) {.inline.} = ## Frees the resources associated with the lock. deinitSys(lock) -proc tryAcquire*(lock: var TLock): bool {.tags: [FAquireLock].} = +proc tryAcquire*(lock: var TLock): bool {.tags: [AquireEffect].} = ## Tries to acquire the given lock. Returns `true` on success. result = tryAcquireSys(lock) when noDeadlocks: @@ -90,7 +92,7 @@ proc tryAcquire*(lock: var TLock): bool {.tags: [FAquireLock].} = inc(locksLen) assert orderedLocks() -proc acquire*(lock: var TLock) {.tags: [FAquireLock].} = +proc acquire*(lock: var TLock) {.tags: [AquireEffect].} = ## Acquires the given lock. when nodeadlocks: var p = addr(lock) @@ -135,7 +137,7 @@ proc acquire*(lock: var TLock) {.tags: [FAquireLock].} = else: acquireSys(lock) -proc release*(lock: var TLock) {.tags: [FReleaseLock].} = +proc release*(lock: var TLock) {.tags: [ReleaseEffect].} = ## Releases the given lock. when nodeadlocks: var p = addr(lock) |