WIP implementation of FutureStream.

This commit is contained in:
Dominik Picheta 2017-02-09 22:46:20 +01:00
commit e189004a03
2 changed files with 103 additions and 8 deletions

View file

@ -0,0 +1,19 @@
import asyncdispatch
var fs = newFutureStream[string]()
proc alpha() {.async.} =
for i in 0 .. 5:
fs.put($i)
await sleepAsync(1000)
fs.complete()
proc beta() {.async.} =
while not fs.finished():
echo(await fs.takeAsync())
echo("Finished")
asyncCheck alpha()
asyncCheck beta()