mirror of
https://github.com/logos-storage/apatheia.git
synced 2026-01-07 15:33:09 +00:00
queues
This commit is contained in:
parent
b48d21966d
commit
e666189efa
11
src/apatheia/queues.nim
Normal file
11
src/apatheia/queues.nim
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
import chronos
|
||||||
|
import chronos/threadsync
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
AsyncQueue*[T] = object
|
||||||
|
signal: ThreadSignalPtr
|
||||||
|
item*: T
|
||||||
|
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ type
|
|||||||
|
|
||||||
proc addNums(a, b: float, ret: ptr ThreadArg) =
|
proc addNums(a, b: float, ret: ptr ThreadArg) =
|
||||||
ret.value = a + b
|
ret.value = a + b
|
||||||
os.sleep(1_000)
|
os.sleep(500)
|
||||||
let res = ret.doneSig.fireSync().get()
|
let res = ret.doneSig.fireSync().get()
|
||||||
if not res:
|
if not res:
|
||||||
echo "ERROR FIRING!"
|
echo "ERROR FIRING!"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user