diff options
Diffstat (limited to 'lib/core/locks.nim')
-rw-r--r-- | lib/core/locks.nim | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/lib/core/locks.nim b/lib/core/locks.nim index 8a809fc84..f1a74876e 100644 --- a/lib/core/locks.nim +++ b/lib/core/locks.nim @@ -1,7 +1,7 @@ # # # Nim's Runtime Library -# (c) Copyright 2012 Andreas Rumpf +# (c) Copyright 2015 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -12,56 +12,45 @@ include "system/syslocks" type - TLock* = TSysLock ## Nim lock; whether this is re-entrant - ## or not is unspecified! - TCond* = TSysCond ## Nim condition variable - - LockEffect* {.deprecated.} = object of RootEffect ## \ - ## effect that denotes that some lock operation - ## is performed. Deprecated, do not use anymore! - AquireEffect* {.deprecated.} = object of LockEffect ## \ - ## effect that denotes that some lock is - ## acquired. Deprecated, do not use anymore! - ReleaseEffect* {.deprecated.} = object of LockEffect ## \ - ## effect that denotes that some lock is - ## released. Deprecated, do not use anymore! -{.deprecated: [FLock: LockEffect, FAquireLock: AquireEffect, - FReleaseLock: ReleaseEffect].} + Lock* = SysLock ## Nim lock; whether this is re-entrant + ## or not is unspecified! + Cond* = SysCond ## Nim condition variable -proc initLock*(lock: var TLock) {.inline.} = +{.deprecated: [TLock: Lock, TCond: Cond].} + +proc initLock*(lock: var Lock) {.inline.} = ## Initializes the given lock. initSysLock(lock) -proc deinitLock*(lock: var TLock) {.inline.} = +proc deinitLock*(lock: var Lock) {.inline.} = ## Frees the resources associated with the lock. deinitSys(lock) -proc tryAcquire*(lock: var TLock): bool = +proc tryAcquire*(lock: var Lock): bool = ## Tries to acquire the given lock. Returns `true` on success. result = tryAcquireSys(lock) -proc acquire*(lock: var TLock) = +proc acquire*(lock: var Lock) = ## Acquires the given lock. acquireSys(lock) - -proc release*(lock: var TLock) = + +proc release*(lock: var Lock) = ## Releases the given lock. releaseSys(lock) -proc initCond*(cond: var TCond) {.inline.} = +proc initCond*(cond: var Cond) {.inline.} = ## Initializes the given condition variable. initSysCond(cond) -proc deinitCond*(cond: var TCond) {.inline.} = +proc deinitCond*(cond: var Cond) {.inline.} = ## Frees the resources associated with the lock. deinitSysCond(cond) -proc wait*(cond: var TCond, lock: var TLock) {.inline.} = - ## waits on the condition variable `cond`. +proc wait*(cond: var Cond, lock: var Lock) {.inline.} = + ## waits on the condition variable `cond`. waitSysCond(cond, lock) - -proc signal*(cond: var TCond) {.inline.} = - ## sends a signal to the condition variable `cond`. - signalSysCond(cond) +proc signal*(cond: var Cond) {.inline.} = + ## sends a signal to the condition variable `cond`. + signalSysCond(cond) |