[std/locks]close #7998(complete condition variables) (#17711)

* close #7998
* workaround genode

* Update lib/system/syslocks.nim
This commit is contained in:
flywind 2021-04-19 16:51:13 +08:00 • committed by GitHub
commit dc89b21257
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 60 additions and 45 deletions

View file

@ -66,13 +66,18 @@ proc deinitCond*(cond: var Cond) {.inline.} =
deinitSysCond(cond)
proc wait*(cond: var Cond, lock: var Lock) {.inline.} =
## waits on the condition variable `cond`.
## Waits on the condition variable `cond`.
waitSysCond(cond, lock)
proc signal*(cond: var Cond) {.inline.} =
## sends a signal to the condition variable `cond`.
## Sends a signal to the condition variable `cond`.
signalSysCond(cond)
proc broadcast*(cond: var Cond) {.inline.} =
## Unblocks all threads currently blocked on the
## specified condition variable `cond`.
broadcastSysCond(cond)
template withLock*(a: Lock, body: untyped) =
## Acquires the given lock, executes the statements in body and
## releases the lock after the statements finish executing.