summary refs log tree commit diff stats
path: root/tests/async/t14820.nim
blob: 359884468eb398dd36e5bc5e4185de6678ce7dc5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
discard """
output: '''
iteration: 1
iteration: 2
iteration: 3
iteration: 4
async done
iteration: 5
'''
"""

import asyncdispatch, times

var done = false
proc somethingAsync() {.async.} =
  yield sleepAsync 5000
  echo "async done"
  done = true
  
asyncCheck somethingAsync()
var count = 0
while not done:
  count += 1
  drain 1000
  echo "iteration: ", count