Process timers before and after select. Fixes flaky #7758 test. (#8750)

This commit is contained in:
Dominik Picheta 2018-08-25 08:44:02 +01:00 • committed by Andreas Rumpf
commit 81f920a4ee
2 changed files with 30 additions and 24 deletions

View file

@ -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()