Various fixes to FutureStreams based on PR feedback.

This commit is contained in:
Dominik Picheta 2017-02-26 12:52:19 +01:00
commit f9cce32097
7 changed files with 72 additions and 48 deletions

View file

@ -19,14 +19,14 @@ var fs = newFutureStream[int]()
proc alpha() {.async.} =
for i in 0 .. 5:
await sleepAsync(1000)
await fs.put(i)
await fs.write(i)
echo("Done")
fs.complete()
proc beta() {.async.} =
while not fs.finished:
let (hasValue, value) = await fs.take()
let (hasValue, value) = await fs.read()
if hasValue:
echo(value)