Fix drain to correctly take into account hasPendingOperations and the timeout value
This commit is contained in:
parent
aa84d35d86
commit
4e6f2b5313
1 changed files with 2 additions and 2 deletions
|
|
@ -1559,8 +1559,8 @@ proc drain*(timeout = 500) =
|
||||||
## Waits for completion events and processes them. Raises ``ValueError``
|
## Waits for completion events and processes them. Raises ``ValueError``
|
||||||
## if there are no pending operations. In contrast to ``poll`` this
|
## if there are no pending operations. In contrast to ``poll`` this
|
||||||
## processes as many events as are available.
|
## processes as many events as are available.
|
||||||
if runOnce(timeout):
|
if runOnce(timeout) or hasPendingOperations():
|
||||||
while hasPendingOperations() and runOnce(0): discard
|
while hasPendingOperations() and runOnce(timeout): discard
|
||||||
|
|
||||||
proc poll*(timeout = 500) =
|
proc poll*(timeout = 500) =
|
||||||
## Waits for completion events and processes them. Raises ``ValueError``
|
## Waits for completion events and processes them. Raises ``ValueError``
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue