Merge pull request #4180 from cheatfate/callsoon2

Resolve bugs with `deep recursion` of asyncdispatch.
This commit is contained in:
Dominik Picheta 2016-05-18 11:45:56 +01:00
commit d3e9589b3d
4 changed files with 31 additions and 10 deletions

View file

@ -36,4 +36,4 @@ proc main {.async.} =
discard await g()
echo 6
asyncCheck main()
waitFor(main())

View file

@ -48,7 +48,7 @@ proc catch() {.async.} =
except OSError, EInvalidField:
assert false
asyncCheck catch()
waitFor catch()
proc test(): Future[bool] {.async.} =
result = false
@ -92,13 +92,13 @@ proc test4(): Future[int] {.async.} =
result = 2
var x = test()
assert x.read
assert x.waitFor()
x = test2()
assert x.read
assert x.waitFor()
var y = test3()
assert y.read == 2
assert y.waitFor() == 2
y = test4()
assert y.read == 2
assert y.waitFor() == 2

View file

@ -16,4 +16,4 @@ x.callback =
proc () =
finished = true
while not finished: discard
while not finished: poll()