Improve docs for IOLoop.add/remove_timeout()
This commit is contained in:
parent
31b0ab0c5d
commit
8a941c42b2
|
@ -309,12 +309,19 @@ class IOLoop(object):
|
||||||
return self._running
|
return self._running
|
||||||
|
|
||||||
def add_timeout(self, deadline, callback):
|
def add_timeout(self, deadline, callback):
|
||||||
"""Calls the given callback at the time deadline from the I/O loop."""
|
"""Calls the given callback at the time deadline from the I/O loop.
|
||||||
|
|
||||||
|
Returns a handle that may be passed to remove_timeout to cancel.
|
||||||
|
"""
|
||||||
timeout = _Timeout(deadline, stack_context.wrap(callback))
|
timeout = _Timeout(deadline, stack_context.wrap(callback))
|
||||||
bisect.insort(self._timeouts, timeout)
|
bisect.insort(self._timeouts, timeout)
|
||||||
return timeout
|
return timeout
|
||||||
|
|
||||||
def remove_timeout(self, timeout):
|
def remove_timeout(self, timeout):
|
||||||
|
"""Cancels a pending timeout.
|
||||||
|
|
||||||
|
The argument is a handle as returned by add_timeout.
|
||||||
|
"""
|
||||||
self._timeouts.remove(timeout)
|
self._timeouts.remove(timeout)
|
||||||
|
|
||||||
def add_callback(self, callback):
|
def add_callback(self, callback):
|
||||||
|
|
Loading…
Reference in New Issue