summary refs log tree commit diff stats
path: root/lib/core
diff options
context:
space:
mode:
authorflywind <xzsflywind@gmail.com>2021-04-19 16:51:13 +0800
committerGitHub <noreply@github.com>2021-04-19 10:51:13 +0200
commitdc89b212572fecd449dd469ffb2424c78941c12f (patch)
treef1458632d93f4c94e06dd3114e49773519ffad56 /lib/core
parentcedbc7035d171d1535365c8acb889911b839ce99 (diff)
downloadNim-dc89b212572fecd449dd469ffb2424c78941c12f.tar.gz
[std/locks]close #7998(complete condition variables) (#17711)
* close #7998
* workaround genode

* Update lib/system/syslocks.nim
Diffstat (limited to 'lib/core')
-rw-r--r--lib/core/locks.nim9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/core/locks.nim b/lib/core/locks.nim
index 674817674..92967b9db 100644
--- a/lib/core/locks.nim
+++ b/lib/core/locks.nim
@@ -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.