Ejemplo n.º 1
0
 def add_timeout(self, deadline, callback):
     """Calls the given callback at the time deadline from the I/O loop."""
     # log.debug("Adding timeout of %r using %r.", deadline, callback)
     timeout = _Timeout(deadline, stack_context.wrap(callback))
     insort(self._timeouts, timeout)
     return timeout
Ejemplo n.º 2
0
 def add_callback(self, callback):
     """Calls the given callback on the next I/O loop iteration."""
     # log.debug("Adding %r callback.", callback)
     self._callbacks.add(stack_context.wrap(callback))
     self._wake()
Ejemplo n.º 3
0
 def add_handler(self, fd, handler, events):
     """Registers the given handler to receive the given events for fd."""
     # log.debug("Registering handler %r on %d.", handler, fd)
     self._handlers[fd] = stack_context.wrap(handler)
     self._impl.register(fd, events | self.ERROR)