Remove immediate FutureStream procs and make 'put' awaitable.

This commit is contained in:
Dominik Picheta 2017-02-10 20:40:32 +01:00
commit 2f502e2a9e
2 changed files with 10 additions and 20 deletions

View file

@ -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)