t7758.nim 224 B

12345678910111213141516
  1. import asyncdispatch
  2. proc task() {.async.} =
  3. await sleepAsync(40)
  4. proc main() =
  5. var counter = 0
  6. var f = task()
  7. while not f.finished:
  8. inc(counter)
  9. poll(10)
  10. doAssert counter <= 5
  11. for i in 0 .. 10: main()