This commit is contained in:
Dominik Picheta
2017-12-22 21:14:27 +00:00
parent 7937e38423
commit 52cc925e0e
4 changed files with 25 additions and 4 deletions

15
tests/async/t6100.nim Normal file
View File

@@ -0,0 +1,15 @@
discard """
file: "t6100.nim"
exitcode: 0
output: "10000000"
"""
import asyncdispatch
let done = newFuture[int]()
done.complete(1)
proc asyncSum: Future[int] {.async.} =
for _ in 1..10_000_000:
result += await done
echo waitFor asyncSum()

View File

@@ -18,8 +18,8 @@ var fs = newFutureStream[int]()
proc alpha() {.async.} =
for i in 0 .. 5:
await sleepAsync(1000)
await fs.write(i)
await sleepAsync(1000)
echo("Done")
fs.complete()