Add pending operations presence check function, fixes #5155
This commit is contained in:
parent
46e4b4854e
commit
8e71949b78
3 changed files with 46 additions and 2 deletions
21
tests/async/tpendingcheck.nim
Normal file
21
tests/async/tpendingcheck.nim
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
discard """
|
||||
file: "tpendingcheck.nim"
|
||||
exitcode: 0
|
||||
output: ""
|
||||
"""
|
||||
|
||||
import asyncdispatch
|
||||
|
||||
doAssert(not hasPendingOperations())
|
||||
|
||||
proc test() {.async.} =
|
||||
await sleepAsync(100)
|
||||
|
||||
var f = test()
|
||||
while not f.finished:
|
||||
doAssert(hasPendingOperations())
|
||||
poll(10)
|
||||
f.read
|
||||
|
||||
doAssert(not hasPendingOperations())
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue