mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-27 17:11:40 +00:00
Fixes #6100.
This commit is contained in:
15
tests/async/t6100.nim
Normal file
15
tests/async/t6100.nim
Normal 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()
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user