main control loop.
513417
def mainloop(self):
        """"""
        try:
            while (not self.ev_quit.is_set()):
                try:
                    self.handle_request()

                except socketTimeout:
                    continue
        finally:
            self.socket.close()
1172254
def run (self):
        """"""
        try:
            self.run_checked()
        except KeyboardInterrupt:
            thread.interrupt_main()
        except Exception:
            self.internal_error()
182319
def main(self, args):
        '''

        '''
        if args.action:
            self.runcmd(args.action, args.arguments)
        else:
            self.cmdloop()
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()
43400
def main_loop(self):
        
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        port = int(getattr(self, 'port', 1738))
        sock.bind(('127.0.0.1', port))
        while True:
            data, addr = sock.recvfrom(512)
            color = data.decode().strip()
            self.color = self.colors.get(color, color)
796651
def main_loop(self):
        """"""

        def exit(signum, frame):
            shutdown()
            sys.exit(0)

        signal.signal(signal.SIGTERM, exit)

        while True:
            task = self._get_next_task_from_raylet()
            self._wait_for_and_process_task(task)
1109344
public function loop()
    {
        try {
            $this->processPendingSignals();

            $this->processPendingCommands();

            // If the supervisor is working, we will perform any needed scaling operations and
            // monitor all of these underlying worker processes to make sure they are still
            // processing queued jobs. If they have died, we will restart them each here.
            if ($this->working) {
                $this->autoScale();

                $this->processPools->each->monitor();
            }

            // Next, we'll persist the supervisor state to storage so that it can be read by a
            // user interface. This contains information on the specific options for it and
            // the current number of worker processes per queue for easy load monitoring.
            $this->persist();

            event(new SupervisorLooped($this));
        } catch (Exception $e) {
            app(ExceptionHandler::class)->report($e);
        } catch (Throwable $e) {
            app(ExceptionHandler::class)->report(new FatalThrowableError($e));
        }
    }
1043892
public void run() {
    while (keep_running) {
      try {
        // tell controller to do some real work for a change
        controller.process();

        // waiting check_interval ms, while taking sleep_interval ms
        // long naps so we can break off faster if the server is shut
        // down
        long wait_start = System.currentTimeMillis();
        do {
          Thread.sleep(sleep_interval);
        } while (keep_running &&
                 (System.currentTimeMillis() - wait_start) < check_interval);

      } catch (Throwable e) {
        controller.reportError(e);
        try {
          Thread.sleep(getErrorWaitInteral()); // wait a good while, then retry
        } catch (InterruptedException e2) {
        }
      }
    }
    controller.reportStopped();
  }
936336
def main(cls):
        """"""
        cmd = cls()
        cmd._parse_args()
        cmd._setup_logging()
        response = cmd._run()
        output = cmd._handle_response(response)
        if output is not None:
            print(output)
983043
def main(self):
        
        loop = MainLoop(self.view, DEFAULT_PALETTE,
                        handle_mouse=self.handle_mouse)
        self.view.show_graphs()
        self.animate_graph(loop)
        try:
            loop.run()
        except (ZeroDivisionError) as err:
            # In case of Zero division, we want an error to return, and
            # get a clue where this happens
            logging.debug("Some stat caused divide by zero exception. Exiting")
            logging.error(err, exc_info=True)
            print(ERROR_MESSAGE)
        except (AttributeError) as err:
            # In this case we restart the loop, to address bug #50, where
            # urwid crashes on multiple presses on 'esc'
            logging.debug("Catch attribute Error in urwid and restart")
            logging.debug(err, exc_info=True)
            self.main()
        except (psutil.NoSuchProcess) as err:
            # This might happen if the stress process is not found, in this
            # case, we want to know why
            logging.error("No such process error")
            logging.error(err, exc_info=True)
            print(ERROR_MESSAGE)
649568
def main():
    """"""
    WIDTH, HEIGHT = 120, 60
    TITLE = None

    with tcod.console_init_root(WIDTH, HEIGHT, TITLE, order="F",
                                renderer=tcod.RENDERER_SDL) as console:
        tcod.sys_set_fps(24)
        while True:
            tcod.console_flush()
            for event in tcod.event.wait():
                print(event)
                if event.type == "QUIT":
                    raise SystemExit()
                elif event.type == "MOUSEMOTION":
                    console.ch[:, -1] = 0
                    console.print_(0, HEIGHT - 1, str(event))
                else:
                    console.blit(console, 0, 0, 0, 1, WIDTH, HEIGHT - 2)
                    console.ch[:, -3] = 0
                    console.print_(0, HEIGHT - 3, str(event))
57531
def main():
    """"""
    while 1:
        events = get_gamepad()
        for event in events:
            print(event.ev_type, event.code, event.state)
1349850
public function main() {
        $this->stdout->styles('success', array('text' => 'green'));

        $this->hr(1);
        $this->out(sprintf('%s Steps:', $this->name));

        $counter = 1;

        foreach ($this->steps as $method) {
            $this->steps($counter);

            try {
                if (!call_user_func(array($this, $method))) {
                    $this->err('<error>Process aborted!</error>');
                    break;
                }
            } catch (Exception $e) {
                $this->err(sprintf('<error>Unexpected error has occurred; %s</error>', $e->getMessage()));
                break;
            }

            $counter++;
        }
    }
1371814
function main()
{
	aqParseOptions();

	aq_amqp = mod_amqp.createConnection(aq_broker);
	aq_amqp.on('ready', function () {
		aq_exchange = aq_amqp.exchange('amq.topic');
		setInterval(aqBlast, 1000);
	});
}
501378
def main():
    """"""
    while 1:
        events = get_key()
        if events:
            for event in events:
                print(event.ev_type, event.code, event.state)
11828
def _run(self):
        ''''''
      
        while self._is_running:
            yield from self._task()

        # Signal that the loop has finished.
        self._run_complete.set_result(True)
1265364
def main():
    """"""
    from docopt import docopt; arguments = docopt(__doc__, version=package.title() + " v" + version)
    global verbose
    verbose = arguments['--verbose']

    if verbose:
	print("target folder: " + target_folder + " (" + project_path +"/" + target_folder + ")")

    if arguments['init']:
	init_current_directory()

    if arguments['build']:
	if arguments['<file>']:
	    buildFile(arguments['<file>'])
	else:
	    buildAll()

    if arguments['watch']:
	if verbose:
	    print("Watching " + project_path)
        import time
	from watchdog.observers import Observer
	event_handler = MyWatchHandler()
	observer = Observer()
	observer.schedule(event_handler, project_path, recursive=True)
	observer.start()
	try:
	    while True:
	        time.sleep(1)
	except KeyboardInterrupt:
	    observer.stop()
	observer.join()

    if arguments['clean']:
	clean()