This commit is contained in:
parent
6f13184e40
commit
81f920a4ee
2 changed files with 30 additions and 24 deletions
|
|
@ -1,18 +1,19 @@
|
|||
discard """
|
||||
file: "t7758.nim"
|
||||
exitcode: 0
|
||||
disabled: true
|
||||
"""
|
||||
import asyncdispatch
|
||||
|
||||
proc task() {.async.} =
|
||||
await sleepAsync(1000)
|
||||
await sleepAsync(40)
|
||||
|
||||
when isMainModule:
|
||||
proc main() =
|
||||
var counter = 0
|
||||
var f = task()
|
||||
while not f.finished:
|
||||
inc(counter)
|
||||
poll()
|
||||
poll(10)
|
||||
|
||||
doAssert counter == 2
|
||||
doAssert counter <= 4
|
||||
|
||||
for i in 0 .. 10: main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue