mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 17:34:43 +00:00
* Fix asyncdispatch drain behavior (#14820) * Changed test to use asyncCheck instead of discard after code review (#14820) * Added some debug statements to help understand what is happening in Azure. * Removed debug statements and increased timeouts by 1 order of magnitude to account for slow Azure VMs Co-authored-by: Ray Imber <ray@crankuptheamps.com>
26 lines
363 B
Nim
26 lines
363 B
Nim
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
|