Returns a stop driver. 
    
    The optional loop argument can be provided to use the driver in another 
    loop than the default one.

    Parameters
    -----------
    loop: BaseEventLoop
        The event loop to use instead of the default one.
485594
def make_driver(loop=None):
    ''' 
    '''
    loop = loop or asyncio.get_event_loop()

    def stop(i = None):
        loop.stop()

    def driver(sink):
        ''' The stop driver stops the asyncio event loop.
        The event loop is stopped as soon as an event is received on the 
        control observable or when it completes (both in case of success or 
        error).

        Parameters
        ----------
            sink: Sink
        '''
        sink.control.subscribe(
            on_next=stop,
            on_error=stop,
            on_completed=stop)
        return None

    return Component(call=driver, input=Sink)
291192
def run(self, *args, **kwargs):
        
        self.eventloop.run_until_complete(self.connect(*args, **kwargs))
        try:
            self.eventloop.run_forever()
        finally:
            self.eventloop.stop()
341696
public function setLoop($loop)
    {
        if (is_bool($loop) === true) {
            $this->loop = $loop;
        } else {
            $msg = "The 'loop' argument must be a boolean value, '" . gettype($loop) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
970264
def run(self):
        

        if self._main_loop:
            return

        self._interface_added_signal = self._bus.add_signal_receiver(
            self._interfaces_added,
            dbus_interface='org.freedesktop.DBus.ObjectManager',
            signal_name='InterfacesAdded')

        # TODO: Also listen to 'interfaces removed' events?

        self._properties_changed_signal = self._bus.add_signal_receiver(
            self._properties_changed,
            dbus_interface=dbus.PROPERTIES_IFACE,
            signal_name='PropertiesChanged',
            arg0='org.bluez.Device1',
            path_keyword='path')

        def disconnect_signals():
            for device in self._devices.values():
                device.invalidate()
            self._properties_changed_signal.remove()
            self._interface_added_signal.remove()

        self._main_loop = GObject.MainLoop()
        try:
            self._main_loop.run()
            disconnect_signals()
        except Exception:
            disconnect_signals()
            raise
652652
def create_eventloop(inputhook=None, recognize_win32_paste=True):
    
    if is_windows():
        from prompt_toolkit.eventloop.win32 import Win32EventLoop as Loop
        return Loop(inputhook=inputhook, recognize_paste=recognize_win32_paste)
    else:
        from prompt_toolkit.eventloop.posix import PosixEventLoop as Loop
        return Loop(inputhook=inputhook)
1042042
function loopParentListener(looper,e)
        {
          var _looper = looper,
              _len = looper.length,
              _e = e,
              _x;
          for(_x=0;_x<_len;_x++)
          {
            _e.child = _e.target;
            _e.target = looper[_x].parent;
            looper[_x].func(_e);
            if(_e._stopPropogation !== undefined) break;
          }
        }
1036402
def exit():
        
        exit_msg = None
        try:
            loop = asyncio.get_event_loop()
            loop.stop()
        except Exception as e:
            logging.error('Could not stop loop: %s\nShutting down anyway..',
                          str(e))
996461
public T loop(int loops, int startDelay, int resetDelay)
	{
		if (loops == 0)
			return self();

		this.loops = loops;
		this.loopStartDelay = Timer.tickToTime(startDelay);
		this.loopResetDelay = Timer.tickToTime(resetDelay);
		return self();
	}
792546
def setup_event_loop(self, actor):
        '''
        '''
        actor.logger = self.cfg.configured_logger('pulsar.%s' % actor.name)
        try:
            loop = asyncio.get_event_loop()
        except RuntimeError:
            if self.cfg and self.cfg.concurrency == 'thread':
                loop = asyncio.new_event_loop()
                asyncio.set_event_loop(loop)
            else:
                raise
        if not hasattr(loop, 'logger'):
            loop.logger = actor.logger
        actor.mailbox = self.create_mailbox(actor, loop)
        return loop
149790
def startLoop(self):
        '''
        
        '''
        first = True
        self._looping = True
        while self._looping:
            if first:
                self._proxy.setBusy(False)
                first = False
            time.sleep(0.5)
82177
private function getEventLoop()
    {
        if (! $this->eventLoop instanceof LoopInterface) {
            $this->eventLoop = EventLoop::create();
        }

        return $this->eventLoop;
    }
1202425
void stopEventBus(@Observes StopBus event) {
        CommandBusOnClient bus = commandBusInst.get();
        bus.stopBus();
    }
1200024
def startLoop(self, useDriverLoop):
        '''
        
        '''
        if useDriverLoop:
            self._driver.startLoop()
        else:
            self._iterator = self._driver.iterate()
1232847
def mainloop(self):
        
        while self.keep_going:
            with self.lock:
                if self.on_connect and not self.readable(2):
                    self.on_connect()
                    self.on_connect = None
                if not self.keep_going:
                    break
                self.process_once()
1239612
def _get_loop(self, *args: typing.Any, **kwargs: typing.Any) -> typing.Optional[asyncio.AbstractEventLoop]:
        """"""
        if callable(self.loop_getter):
            if self.loop_getter_need_context:
                return self.loop_getter(*args, **kwargs)  # pylint: disable=not-callable
            return self.loop_getter()  # pylint: disable=not-callable
        return self.loop_getter
1217539
def terminate(*)
      return if __getobj__.stopped?

      __getobj__.terminate
      event_bus.notify Events::CommandStopped.new(self)

      self
    end
1200249
def stop(self):
        
        # Exit the loop
        with self._lock:
            self._stop_event.set()
            self._shell_event.clear()

        if self._context is not None:
            # Unregister from events
            self._context.remove_service_listener(self)

            # Release the shell
            self.clear_shell()
            self._context = None