Merge pull request #6962 from nim-lang/fixes/6100

Fixes #6100.
This commit is contained in:
Dominik Picheta 2018-01-10 23:11:26 +00:00 • committed by GitHub
commit 2c905f5e81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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()