Remove immediate FutureStream procs and make 'put' awaitable.
This commit is contained in:
parent
ddd3d3f44a
commit
2f502e2a9e
2 changed files with 10 additions and 20 deletions
|
|
@ -19,13 +19,13 @@ var fs = newFutureStream[int]()
|
|||
proc alpha() {.async.} =
|
||||
for i in 0 .. 5:
|
||||
await sleepAsync(1000)
|
||||
fs.put(i)
|
||||
await fs.put(i)
|
||||
|
||||
fs.complete()
|
||||
|
||||
proc beta() {.async.} =
|
||||
while not fs.finished:
|
||||
let (hasValue, value) = await fs.takeAsync()
|
||||
let (hasValue, value) = await fs.take()
|
||||
if hasValue:
|
||||
echo(value)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue