From 8732cc13fb8a873469ce0664d47707842909d2ec Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Fri, 9 Feb 2024 21:52:37 -0700 Subject: [PATCH] rename queue --- src/apatheia/queues.nim | 3 ++- tests/tasyncsEx2.nim | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/apatheia/queues.nim b/src/apatheia/queues.nim index 6ae6fc9..b4e483d 100644 --- a/src/apatheia/queues.nim +++ b/src/apatheia/queues.nim @@ -59,5 +59,6 @@ proc tryRecv*[T](c: SignalQueue[T]): Option[T] = if res.dataAvailable: some res.msg -proc wait*[T](c: SignalQueue[T]) {.async.} = +proc wait*[T](c: SignalQueue[T]): Future[Result[T, string]] {.async.} = await wait(c.signal) + return c.recv() diff --git a/tests/tasyncsEx2.nim b/tests/tasyncsEx2.nim index 2a0e601..15524a5 100644 --- a/tests/tasyncsEx2.nim +++ b/tests/tasyncsEx2.nim @@ -27,8 +27,8 @@ suite "async tests": # await sleepAsync(100.milliseconds) echo "waiting on queue" - await wait(queue).wait(1500.milliseconds) - echo "result: ", queue.recv() + let res = await wait(queue).wait(1500.milliseconds) + echo "result: ", res # echo "\nRES: ", args.value