Fixes #4262.
This commit is contained in:
parent
04c1caf025
commit
5bf16439e1
3 changed files with 94 additions and 68 deletions
19
tests/async/tpolltimeouts.nim
Normal file
19
tests/async/tpolltimeouts.nim
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
discard """
|
||||
output: "true"
|
||||
"""
|
||||
# Issue https://github.com/nim-lang/Nim/issues/4262
|
||||
import asyncdispatch, times
|
||||
|
||||
proc foo(): Future[int] {.async.} =
|
||||
return 1
|
||||
|
||||
proc bar(): Future[int] {.async.} =
|
||||
return await foo()
|
||||
|
||||
let start = epochTime()
|
||||
let barFut = bar()
|
||||
|
||||
while not barFut.finished:
|
||||
poll(2000)
|
||||
|
||||
echo(epochTime() - start < 1.0)
|
||||
Loading…
Add table
Add a link
Reference in a new issue