[std/locks]close #7998(complete condition variables) (#17711)
* close #7998 * workaround genode * Update lib/system/syslocks.nim
This commit is contained in:
parent
cedbc7035d
commit
dc89b21257
5 changed files with 60 additions and 45 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue