tpolltimeouts.nim 337 B

1234567891011121314151617181920
  1. discard """
  2. output: "true"
  3. """
  4. # Issue https://github.com/nim-lang/Nim/issues/4262
  5. import asyncdispatch, times
  6. proc foo(): Future[int] {.async.} =
  7. return 1
  8. proc bar(): Future[int] {.async.} =
  9. return await foo()
  10. let start = epochTime()
  11. let barFut = bar()
  12. while not barFut.finished:
  13. poll(2000)
  14. echo(epochTime() - start < 1.0)