Add hasPendingOperations check to asyncdispatch.drain

This commit is contained in:
Ruslan Mustakov
2017-12-30 15:41:41 +07:00
committed by Andreas Rumpf
parent 29db57a804
commit 3073f08e48

View File

@@ -1487,7 +1487,7 @@ proc drain*(timeout = 500) =
## if there are no pending operations. In contrast to ``poll`` this
## processes as many events as are available.
if runOnce(timeout):
while runOnce(0): discard
while hasPendingOperations() and runOnce(0): discard
proc poll*(timeout = 500) =
## Waits for completion events and processes them. Raises ``ValueError``