Public Member Functions | |
def | add_callback |
def | add_handler |
def | call_at |
def | close |
def | initialize |
def | remove_handler |
def | remove_timeout |
def | start |
def | stop |
def | update_handler |
Public Attributes | |
asyncio_loop | |
close_loop | |
closing | |
handlers | |
readers | |
writers | |
Static Public Attributes | |
add_callback_from_signal = add_callback | |
Private Member Functions | |
def | _handle_events |
Definition at line 32 of file asyncio.py.
def tornado.platform.asyncio.BaseAsyncIOLoop._handle_events | ( | self, | |
fd, | |||
events | |||
) | [private] |
Definition at line 101 of file asyncio.py.
def tornado.platform.asyncio.BaseAsyncIOLoop.add_callback | ( | self, | |
callback, | |||
args, | |||
kwargs | |||
) |
Calls the given callback on the next I/O loop iteration. It is safe to call this method from any thread at any time, except from a signal handler. Note that this is the **only** method in `IOLoop` that makes this thread-safety guarantee; all other interaction with the `IOLoop` must be done from that `IOLoop`'s thread. `add_callback()` may be used to transfer control from other threads to the `IOLoop`'s thread. To add a callback from a signal handler, see `add_callback_from_signal`.
Reimplemented from tornado.ioloop.IOLoop.
Definition at line 123 of file asyncio.py.
def tornado.platform.asyncio.BaseAsyncIOLoop.add_handler | ( | self, | |
fd, | |||
handler, | |||
events | |||
) |
Registers the given handler to receive the given events for ``fd``. The ``fd`` argument may either be an integer file descriptor or a file-like object with a ``fileno()`` method (and optionally a ``close()`` method, which may be called when the `IOLoop` is shut down). The ``events`` argument is a bitwise or of the constants ``IOLoop.READ``, ``IOLoop.WRITE``, and ``IOLoop.ERROR``. When an event occurs, ``handler(fd, events)`` will be run. .. versionchanged:: 4.0 Added the ability to pass file-like objects in addition to raw file descriptors.
Reimplemented from tornado.ioloop.IOLoop.
Definition at line 54 of file asyncio.py.
def tornado.platform.asyncio.BaseAsyncIOLoop.call_at | ( | self, | |
when, | |||
callback, | |||
args, | |||
kwargs | |||
) |
Runs the ``callback`` at the absolute time designated by ``when``. ``when`` must be a number using the same reference point as `IOLoop.time`. Returns an opaque handle that may be passed to `remove_timeout` to cancel. Note that unlike the `asyncio` method of the same name, the returned object does not have a ``cancel()`` method. See `add_timeout` for comments on thread-safety and subclassing. .. versionadded:: 4.0
Reimplemented from tornado.ioloop.IOLoop.
Definition at line 112 of file asyncio.py.
def tornado.platform.asyncio.BaseAsyncIOLoop.close | ( | self, | |
all_fds = False |
|||
) |
Closes the `IOLoop`, freeing any resources used. If ``all_fds`` is true, all file descriptors registered on the IOLoop will be closed (not just the ones created by the `IOLoop` itself). Many applications will only use a single `IOLoop` that runs for the entire lifetime of the process. In that case closing the `IOLoop` is not necessary since everything will be cleaned up when the process exits. `IOLoop.close` is provided mainly for scenarios such as unit tests, which create and destroy a large number of ``IOLoops``. An `IOLoop` must be completely stopped before it can be closed. This means that `IOLoop.stop()` must be called *and* `IOLoop.start()` must be allowed to return before attempting to call `IOLoop.close()`. Therefore the call to `close` will usually appear just after the call to `start` rather than near the call to `stop`. .. versionchanged:: 3.1 If the `IOLoop` implementation supports non-integer objects for "file descriptors", those objects will have their ``close`` method when ``all_fds`` is true.
Reimplemented from tornado.ioloop.IOLoop.
Definition at line 44 of file asyncio.py.
def tornado.platform.asyncio.BaseAsyncIOLoop.initialize | ( | self, | |
asyncio_loop, | |||
close_loop = False |
|||
) |
Definition at line 33 of file asyncio.py.
def tornado.platform.asyncio.BaseAsyncIOLoop.remove_handler | ( | self, | |
fd | |||
) |
Stop listening for events on ``fd``. .. versionchanged:: 4.0 Added the ability to pass file-like objects in addition to raw file descriptors.
Reimplemented from tornado.ioloop.IOLoop.
Definition at line 89 of file asyncio.py.
def tornado.platform.asyncio.BaseAsyncIOLoop.remove_timeout | ( | self, | |
timeout | |||
) |
Cancels a pending timeout. The argument is a handle as returned by `add_timeout`. It is safe to call `remove_timeout` even if the callback has already been run.
Reimplemented from tornado.ioloop.IOLoop.
Definition at line 120 of file asyncio.py.
def tornado.platform.asyncio.BaseAsyncIOLoop.start | ( | self | ) |
Starts the I/O loop. The loop will run until one of the callbacks calls `stop()`, which will make the loop stop after the current event iteration completes.
Reimplemented from tornado.ioloop.IOLoop.
Definition at line 105 of file asyncio.py.
def tornado.platform.asyncio.BaseAsyncIOLoop.stop | ( | self | ) |
Stop the I/O loop. If the event loop is not currently running, the next call to `start()` will return immediately. To use asynchronous methods from otherwise-synchronous code (such as unit tests), you can start and stop the event loop like this:: ioloop = IOLoop() async_method(ioloop=ioloop, callback=ioloop.stop) ioloop.start() ``ioloop.start()`` will return after ``async_method`` has run its callback, whether that callback was invoked before or after ``ioloop.start``. Note that even after `stop` has been called, the `IOLoop` is not completely stopped until `IOLoop.start` has also returned. Some work that was scheduled before the call to `stop` may still be run before the `IOLoop` shuts down.
Reimplemented from tornado.ioloop.IOLoop.
Definition at line 109 of file asyncio.py.
def tornado.platform.asyncio.BaseAsyncIOLoop.update_handler | ( | self, | |
fd, | |||
events | |||
) |
Changes the events we listen for ``fd``. .. versionchanged:: 4.0 Added the ability to pass file-like objects in addition to raw file descriptors.
Reimplemented from tornado.ioloop.IOLoop.
Definition at line 68 of file asyncio.py.
Definition at line 130 of file asyncio.py.
Definition at line 33 of file asyncio.py.
Definition at line 33 of file asyncio.py.
Definition at line 33 of file asyncio.py.
Definition at line 33 of file asyncio.py.
Definition at line 33 of file asyncio.py.
Definition at line 33 of file asyncio.py.