File tree 2 files changed +4
-3
lines changed
2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ def wait(self, delay):
103
103
if isinstance (cb , tuple ):
104
104
cb [0 ](* cb [1 ])
105
105
else :
106
- cb .pend_throw (None ) # Clears the pend_throw(False) executed when IOWrite was yielded
106
+ cb .pend_throw (None ) # Ensure that, if task is cancelled, it doesn't get queued again
107
107
self ._call_io (cb ) # Put coro onto runq (or ioq if one exists)
108
108
if ev & select .POLLIN :
109
109
cb = self .rdobjmap [id (sock )]
Original file line number Diff line number Diff line change @@ -200,7 +200,8 @@ def run_forever(self):
200
200
if isinstance (ret , After ):
201
201
delay = int (delay * 1000 )
202
202
elif isinstance (ret , IORead ): # coro was a StreamReader read method
203
- cb .pend_throw (False ) # Why? I think this is for debugging. If it is scheduled other than by wait
203
+ cb .pend_throw (False ) # If task is cancelled or times out, it is put on runq to process exception.
204
+ # Note if it is scheduled other than by wait
204
205
# (which does pend_throw(None) an exception (exception doesn't inherit from Exception) is thrown
205
206
self .add_reader (arg , cb ) # Set up select.poll for read and store the coro in object map
206
207
continue # Don't reschedule. Coro is scheduled by wait() when poll indicates h/w ready
@@ -361,7 +362,7 @@ def __next__(self):
361
362
362
363
def cancel (coro ):
363
364
prev = coro .pend_throw (CancelledError ())
364
- if prev is False :
365
+ if prev is False : # Not on runq so put it there
365
366
_event_loop .call_soon (coro )
366
367
367
368
You can’t perform that action at this time.
0 commit comments