mirror of
https://github.com/logos-storage/apatheia.git
synced 2026-01-03 13:33:08 +00:00
fire signal
This commit is contained in:
parent
94c9ad01f6
commit
b6b77a686c
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user