Starts the main loop that is necessary to receive Bluetooth events from the Bluetooth adapter.

        This call blocks until you call `stop()` to stop the main loop.
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
369015
@Override
    void startListening() {
        if (!listening) {
            final IntentFilter filter = new IntentFilter();
            filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
            Log.v(DOMAIN, "%s: startListening() registering %s with context %s", this, receiver, context);
            context.registerReceiver(receiver, filter);
            listening = true;
        }
    }
1208203
def start
      @stop = false
      @reader_thread = Thread.new {
        begin
          message = @port.gets(@separator)
          changed
          notify_observers(message)
        end while (@stop == false)
      }
    end
915341
public synchronized void stop() {
        if (mConnectThread != null) {
            mConnectThread.cancel();
            mConnectThread = null;
        }

        if (mConnectedThread != null) {
            mConnectedThread.cancel();
            mConnectedThread = null;
        }

        if (mSecureAcceptThread != null) {
            mSecureAcceptThread.cancel();
            mSecureAcceptThread.kill();
            mSecureAcceptThread = null;
        }
        setState(BluetoothService.STATE_NONE);
    }
563009
def start(self):
        
        # Create the multicast socket (update the group)
        self._socket, self._group = create_multicast_socket(self._group,
                                                            self._port)

        # Start the listening thread
        self._stop_event.clear()
        self._thread = threading.Thread(
            target=self.__read,
            name="MulticastReceiver-{0}".format(self._port))
        self._thread.start()
194481
public void start()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "start");

        // Propogate the stop stimulus to the destination handlers...
        DestinationTypeFilter destFilter = new DestinationTypeFilter();
        destFilter.LOCAL = Boolean.TRUE;
        SIMPIterator itr = destinationIndex.iterator(destFilter);
        while (itr.hasNext())
        {
            DestinationHandler dh = (DestinationHandler) itr.next();
            dh.start();
        }
        itr.finished();

        //busses
        itr = foreignBusIndex.iterator();
        while (itr.hasNext())
        {
            DestinationHandler dh = (DestinationHandler) itr.next();
            dh.start();
        }
        itr.finished();

        //links
        LinkTypeFilter linkFilter = new LinkTypeFilter();
        linkFilter.LOCAL = Boolean.TRUE;
        itr = linkIndex.iterator(linkFilter);
        while (itr.hasNext())
        {
            DestinationHandler dh = (DestinationHandler) itr.next();
            dh.start();
        }
        itr.finished();

        // Explicitly start the async deletion thread.
        startAsynchDeletion();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "start");
    }
228794
def run(self):
        """"""
        self.signal_init()
        self.listen_init()
        self.logger.info('starting')
        self.loop.start()
291192
def run(self, *args, **kwargs):
        
        self.eventloop.run_until_complete(self.connect(*args, **kwargs))
        try:
            self.eventloop.run_forever()
        finally:
            self.eventloop.stop()
738436
def _main_loop(self):
        '''
        
        '''
        while self.active:
            self.expire()
            if self.roll and self.is_expired():
                self.start_time = self.start_time + self.window
                self._set_key()
            self.purge_old()
            time.sleep(self.cycle_time)
        self._clean_up()
402274
def loop(self):
        
        logging.info("Running %s in loop mode." % self.service_name)

        res = None
        while True:
            try:
                res = self.run()
                time.sleep(self.loop_duration)
            except KeyboardInterrupt:
                logging.warning("Keyboard Interrupt during loop, stopping %s service now..." % self.service_name)
                break
            except Exception as e:
                logging.exception("Error in %s main loop! (%s)" % (self.service_name, e))
                raise e
        return res
165876
def start(self):
        
        self.stop()
        self._task = asyncio.ensure_future(self._pinger(), loop=self._loop)
760434
private synchronized void mainLoop() {
        for (Task task: taskDao.listTasks()) {
            if (task.getState().equals(Task.STARTING)) {
                startTask(task);
            } else if (task.getState().equals(Task.PAUSING)) {
                pauseTask(task);
            } else if (task.getState().equals(Task.RESUMING)) {
                resumeTask(task);
            } else if (task.getState().equals(Task.CANCELING)) {
                cancelTask(task);
            }
        }
        try {
            wait(POLL_SECONDS * 1000);
        } catch (InterruptedException e) {
        }
    }
144575
def loop_stop(self, force=False):
        
        if self._thread is None:
            return MQTT_ERR_INVAL

        self._thread_terminate = True
        self._thread.join()
        self._thread = None
1113281
def _loop_thread_main(self):
        """"""

        asyncio.set_event_loop(self.loop)
        self._loop_check.inside_loop = True

        try:
            self._logger.debug("Starting loop in background thread")
            self.loop.run_forever()
            self._logger.debug("Finished loop in background thread")
        except:  # pylint:disable=bare-except;This is a background worker thread.
            self._logger.exception("Exception raised from event loop thread")
        finally:
            self.loop.close()
436748
def start(self):
        
        self.running = True
        self.thread = threading.Thread(target=self._main_loop)
        self.thread.start()
1117014
def run(self):
        
        listener_thr = _spawn(self.receiver.run)
        callback_thr = _spawn(self.callbacks.run)
        sender_thr = _spawn(self.sender.run)
        logger_thr = _spawn(self.logger.run)

        self.connect()
        try:
            yield
        finally:
            self.stop()

            # Wait for the listener to finish.
            listener_thr.join()
            self.callbacks.put('shutdown')

            # Tell the other threads to finish, and wait for them.
            for obj in [self.callbacks, self.sender, self.logger]:
                obj.stop()
            for thr in [callback_thr, sender_thr, logger_thr]:
                thr.join()
767196
def run(self):
        
        self._connection = self.connect()
        self._connection.ioloop.start()