make tests green

This commit is contained in:
Araq 2014-08-31 15:15:26 +02:00
commit 30823c1ce3
44 changed files with 415 additions and 403 deletions

View file

@ -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)