def _run(self): """Run event loop.""" loop = self.loop started = self._started stopped = self._stopped greenlet = self._greenlet loop = self._setup_loop(loop) logger.debug('Loop %s started...', hex(id(loop))) started.set() try: greenlet.switch() finally: logger.debug('Loop %s stopped...', hex(id(loop))) stopped.set() self._teardown_loop(loop)
def switch(self): switch_out = getattr(getcurrent(), 'switch_out', None) if switch_out is not None: switch_out() return greenlet.switch(self)
def _start(self): try: greenlet = self.greenlet_class(self.handle) greenlet.switch() except: self.hub.handle_error(None, *sys._exc_info())
def switch(self): switch_out = getattr(getcurrent(), "switch_out", None) if switch_out is not None: switch_out() return RawGreenlet.switch(self)