From b6b77a686c6d0a4f9ce43f36862e40acd09aa1d7 Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Fri, 9 Feb 2024 21:19:45 -0700 Subject: [PATCH] fire signal --- src/apatheia/queues.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/apatheia/queues.nim b/src/apatheia/queues.nim index f7aa638..95a2914 100644 --- a/src/apatheia/queues.nim +++ b/src/apatheia/queues.nim @@ -29,9 +29,12 @@ proc new*[T](tp: typedesc[AsyncQueue[T]]): AsyncQueue[T] {.raises: [ApatheiaSign proc send*[T](c: AsyncQueue[T], msg: sink T) {.inline.} = ## Sends a message to a thread. `msg` is copied. c.chan.send(msg) + c.signal.fireSync() proc trySend*[T](c: AsyncQueue[T], msg: sink T): bool {.inline.} = - c.chan.trySend(msg) + result = c.chan.trySend(msg) + if result: + c.signal.fireSync() proc recv*[T](c: AsyncQueue[T]): T = c.chan.recv()