Public Member Functions | Public Attributes | Private Attributes
tornado.ioloop.PollIOLoop Class Reference
Inheritance diagram for tornado.ioloop.PollIOLoop:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def add_callback
def add_callback_from_signal
def add_handler
def call_at
def close
def initialize
def remove_handler
def remove_timeout
def set_blocking_signal_threshold
def start
def stop
def time
def update_handler

Public Attributes

 time_func

Private Attributes

 _blocking_signal_threshold
 _callback_lock
 _callbacks
 _cancellations
 _closing
 _events
 _handlers
 _impl
 _running
 _stopped
 _thread_ident
 _timeout_counter
 _timeouts
 _waker

Detailed Description

Base class for IOLoops built around a select-like function.

For concrete implementations, see `tornado.platform.epoll.EPollIOLoop`
(Linux), `tornado.platform.kqueue.KQueueIOLoop` (BSD and Mac), or
`tornado.platform.select.SelectIOLoop` (all platforms).

Definition at line 629 of file ioloop.py.


Member Function Documentation

def tornado.ioloop.PollIOLoop.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 882 of file ioloop.py.

def tornado.ioloop.PollIOLoop.add_callback_from_signal (   self,
  callback,
  args,
  kwargs 
)
Calls the given callback on the next I/O loop iteration.

Safe for use from a Python signal handler; should not be used
otherwise.

Callbacks added with this method will be run without any
`.stack_context`, to avoid picking up the context of the function
that was interrupted by the signal.

Reimplemented from tornado.ioloop.IOLoop.

Definition at line 898 of file ioloop.py.

def tornado.ioloop.PollIOLoop.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 674 of file ioloop.py.

def tornado.ioloop.PollIOLoop.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 865 of file ioloop.py.

def tornado.ioloop.PollIOLoop.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 662 of file ioloop.py.

def tornado.ioloop.PollIOLoop.initialize (   self,
  impl,
  time_func = None 
)

Definition at line 636 of file ioloop.py.

def tornado.ioloop.PollIOLoop.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 683 of file ioloop.py.

def tornado.ioloop.PollIOLoop.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 873 of file ioloop.py.

def tornado.ioloop.PollIOLoop.set_blocking_signal_threshold (   self,
  seconds,
  action 
)
Sends a signal if the `IOLoop` is blocked for more than
``s`` seconds.

Pass ``seconds=None`` to disable.  Requires Python 2.6 on a unixy
platform.

The action parameter is a Python signal handler.  Read the
documentation for the `signal` module for more information.
If ``action`` is None, the process will be killed if it is
blocked for too long.

Reimplemented from tornado.ioloop.IOLoop.

Definition at line 692 of file ioloop.py.

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 702 of file ioloop.py.

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 857 of file ioloop.py.

Returns the current time according to the `IOLoop`'s clock.

The return value is a floating-point number relative to an
unspecified time in the past.

By default, the `IOLoop`'s time function is `time.time`.  However,
it may be configured to use e.g. `time.monotonic` instead.
Calls to `add_timeout` that pass a number instead of a
`datetime.timedelta` should use this function to compute the
appropriate time, so they can work no matter what time function
is chosen.

Reimplemented from tornado.ioloop.IOLoop.

Definition at line 862 of file ioloop.py.

def tornado.ioloop.PollIOLoop.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 679 of file ioloop.py.


Member Data Documentation

Definition at line 636 of file ioloop.py.

Definition at line 636 of file ioloop.py.

Definition at line 636 of file ioloop.py.

Definition at line 636 of file ioloop.py.

Definition at line 636 of file ioloop.py.

Definition at line 636 of file ioloop.py.

Definition at line 636 of file ioloop.py.

Definition at line 636 of file ioloop.py.

Definition at line 636 of file ioloop.py.

Definition at line 636 of file ioloop.py.

Definition at line 636 of file ioloop.py.

Definition at line 636 of file ioloop.py.

Definition at line 636 of file ioloop.py.

Definition at line 636 of file ioloop.py.

Definition at line 636 of file ioloop.py.


The documentation for this class was generated from the following file:


rosbridge_server
Author(s): Jonathan Mace
autogenerated on Wed Sep 13 2017 03:18:20