Exemplo n.º 1
0
    def add_timeout(self, deadline, callback):
        """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, tornado_stack_context.wrap(callback))
        bisect.insort(self._timeouts, timeout)
        return timeout
Exemplo n.º 2
0
  def add_timeout(self, deadline, callback):
    """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, tornado_stack_context.wrap(callback))
    bisect.insort(self._timeouts, timeout)
    return timeout
Exemplo n.º 3
0
    def add_callback(self, callback):
        """Calls the given callback on the next I/O loop iteration.

    It is safe to call this method from any thread at any time.
    Note that this is the *only* method in IOLoop that makes this
    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.
    """
        self._callbacks.append(tornado_stack_context.wrap(callback))
        self._wake()
Exemplo n.º 4
0
  def add_callback(self, callback):
    """Calls the given callback on the next I/O loop iteration.

    It is safe to call this method from any thread at any time.
    Note that this is the *only* method in IOLoop that makes this
    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.
    """
    self._callbacks.append(tornado_stack_context.wrap(callback))
    self._wake()
Exemplo n.º 5
0
 def add_handler(self, fd, handler, events):
     """Registers the given handler to receive the given events for fd."""
     self._handlers[fd] = tornado_stack_context.wrap(handler)
     self._impl.register(fd, events | self.ERROR)
Exemplo n.º 6
0
 def add_handler(self, fd, handler, events):
   """Registers the given handler to receive the given events for fd."""
   self._handlers[fd] = tornado_stack_context.wrap(handler)
   self._impl.register(fd, events | self.ERROR)