Starts the scheduler in a new thread. Returns 0 if success.
        In standalone mode, this method will block until there are no more scheduled jobs.
185716
def start(self):
        
        self.history.append("Started on %s" % time.asctime())
        self.start_time = time.time()

        if not has_apscheduler:
            raise RuntimeError("Install apscheduler with pip")

        if has_sched_v3:
            self.sched.add_job(self.callback, "interval", **self.sched_options)
        else:
            self.sched.add_interval_job(self.callback, **self.sched_options)

        errors = self.flow.look_before_you_leap()
        if errors:
            self.exceptions.append(errors)
            return 1

        # Try to run the job immediately. If something goes wrong return without initializing the scheduler.
        self._runem_all()

        if self.exceptions:
            self.cleanup()
            self.send_email(msg="Error while trying to run the flow for the first time!\n %s" % self.exceptions)
            return 1

        try:
            self.sched.start()
            return 0

        except KeyboardInterrupt:
            self.shutdown(msg="KeyboardInterrupt from user")
            if ask_yesno("Do you want to cancel all the jobs in the queue? [Y/n]"):
                print("Number of jobs cancelled:", self.flow.cancel())

            self.flow.pickle_dump()
            return -1
228514
def start!
      # Activate the monitor
      @active = true

      # Connect to the database
      Minicron.establish_db_connection(
        Minicron.config['server']['database'],
        Minicron.config['verbose']
      )

      # Set the start time of the monitir
      @start_time = Time.now.utc

      # Start a thread for the monitor
      @thread = Thread.new do
        # While the monitor is active run it in a loop ~every minute
        while @active
          # Get all the schedules
          schedules = Minicron::Hub::Model::Schedule.all

          # Loop every schedule we know about
          schedules.each do |schedule|
            begin
              # TODO: is it possible to monitor on boot schedules some other way?
              monitor(schedule) unless schedule.special == '@reboot'
            rescue Exception => e
              if Minicron.config['debug']
                puts e.message
                puts e.backtrace
              end
            end
          end

          sleep 59
        end
      end
    end
400586
synchronized void startFlusher()
  {
    // Create a new scheduled executor service with a threadfactory that
    // creates daemonized threads; this way if the user doesn't exit nicely
    // the JVM Runtime won't hang
    flusher =
        Executors.newScheduledThreadPool(1,
                                         new ThreadFactory()
                                         {
                                           @Override
                                           public Thread newThread(Runnable r)
                                           {
                                             Thread t =
                                                 Executors.defaultThreadFactory().newThread(r);
                                             t.setDaemon(true);
                                             return t;
                                           }
                                         });

    flusher.scheduleWithFixedDelay(new QueueFlusher(),
                                   0,
                                   flushPeriodMs,
                                   TimeUnit.MILLISECONDS);
  }
1039857
def start(self) -> None:
        """"""
        # Looking up the IOLoop here allows to first instantiate the
        # PeriodicCallback in another thread, then start it using
        # IOLoop.add_callback().
        self.io_loop = IOLoop.current()
        self._running = True
        self._next_timeout = self.io_loop.time()
        self._schedule_next()
1014401
private void start(boolean daemon) {
        if (daemon == Thread.currentThread().isDaemon()) {
            server.start();
        } else {
            FutureTask<Void> startTask = new FutureTask<Void>(new Runnable() {
                @Override
                public void run() {
                    server.start();
                }
            }, null);
            NamedDaemonThreadFactory.defaultThreadFactory(daemon).newThread(startTask).start();
            try {
                startTask.get();
            } catch (ExecutionException e) {
                throw new RuntimeException("Unexpected exception on starting HTTPSever", e);
            } catch (InterruptedException e) {
                // This is possible only if the current tread has been interrupted,
                // but in real use cases this should not happen.
                // In any case, there is nothing to do, except to propagate interrupted flag.
                Thread.currentThread().interrupt();
            }
        }
    }
534287
protected void startThreadIfNeeded() {
        // create and start thread if one doesn't exist
        while (executor.get() == null || ! executor.get().isInitialized()) {
            if (executor.compareAndSet(null, new ScheduledExecutor())) {
                // initialize the executor that we 'won' setting
                executor.get().initialize();
            }
        }
    }
346410
def start(self):
        
        self._thread = t = threading.Thread(target=self._monitor)
        t.setDaemon(True)
        t.start()
1195647
def start(self):
		
		if not hasattr(self,"thread") or not self.thread.isAlive():
			self.thread = threading.Thread(target=self.__run)
			self.status = RUNNING
			self.reset()
			self.thread.start()
		else:
			print("Clock already running!")
992241
def start(self) -> None:
        
        self.stop()  # stop an existing thread
        self._thread = receiverThread(socket=self.sock, callbacks=self._callbacks)
        self._thread.start()
641411
def start!
      wait

      logger.warn 'Tasks list is empty' if tasks.empty?
      tasks.each do |task|
        run_task(task)
        sleep post_task_sleep_time
      end

      scheduler.join
    rescue SystemExit, Interrupt
      logger.info 'Shutting down'
      scheduler.shutdown
    end
241213
def start(self):
		
		if self._thread_running.is_set():
			raise RuntimeError('the JobManager has already been started')
		self._thread.start()
		self._thread_running.wait()
		return
225803
private void startWorker() {
    JobServiceFactory serviceFactory = new JobServiceFactory() {

      private boolean first = true;

      public JobService connect() {
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            setStatus("Connecting...");
          }
        });
        JobService service = first ? MainWindow.this.connect()
            : reconnect();
        if (service == null) {
          setVisible(false);
          throw new RuntimeException("Unable to connect");
        }
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            setStatus("Connected");
          }
        });
        first = false;
        return service;
      }
//
//      public JobService connect() {
//        try {
//          SwingUtilities.invokeAndWait(task);
//        } catch (Exception e) {
//          logger.warn("Exception thrown trying to reconnect", e);
//          throw new RuntimeException(e);
//        }
//        if (task.service == null) {
//          throw new RuntimeException("No service.");
//        }
//        return task.service;
//      }

    };

    int availableCpus = Runtime.getRuntime().availableProcessors();
    if (options.numberOfCpus < 0) {
      options.numberOfCpus = pref.getInt("maxCpus", 0);
    }
    if (options.numberOfCpus <= 0 || options.numberOfCpus > availableCpus) {
      options.numberOfCpus = availableCpus;
    }

    if (worker != null) {
      setStatus("Shutting down worker...");
      worker.shutdown();
      try {
        workerThread.join();
      } catch (InterruptedException e) {
      }
      progressPanel.clear();
    }

    setStatus("Starting worker...");

    CourtesyMonitor courtesyMonitor = (powerMonitor != null) ? powerMonitor
        : new UnconditionalCourtesyMonitor();
    ThreadFactory threadFactory = new BackgroundThreadFactory();
    worker = new ThreadServiceWorker(serviceFactory, threadFactory,
        getProgressPanel(), courtesyMonitor);
    worker.setMaxWorkers(options.numberOfCpus);

    boolean cacheClassDefinitions = pref.getBoolean("cacheClassDefinitions", true);
    if (cacheClassDefinitions) {
      setStatus("Preparing data source...");
      EmbeddedDataSource ds = null;
      try {
        Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
        ds = new EmbeddedDataSource();
        ds.setConnectionAttributes("create=true");
        ds.setDatabaseName("classes");
        worker.setDataSource(ds);
      } catch (ClassNotFoundException e) {
        logger.error("Could not locate database driver.", e);
      } catch (SQLException e) {
        logger.error("Error occurred while initializing data source.", e);
      }
    }

    onPreferencesChanged();

    workerThread = new Thread(worker);
    workerThread.start();

  }
584257
private void startLogScheduler() {
    this.logScheduler.scheduleAtFixedRate(
        new Runnable() {
          @Override
          public void run() {
            CLRBufferedLogHandler.this.logAll();
          }
        }, 0, LOG_SCHEDULE_PERIOD, TimeUnit.SECONDS);
  }
1130341
public synchronized boolean startMonitor() {
        if (this.executor != null) {
            if (this.monitorHandle == null) {
                this.monitorHandle = this.executor.scheduleWithFixedDelay(this.monitor, this.monitorInterval, this.monitorInterval, TimeUnit.MILLISECONDS);
            }
            return true;
        }
        return false;
    }
1316393
public Scheduler getScheduler() {
    if (scheduler == null) {
      scheduler = new Scheduler();
      scheduler.setDaemon(true);
      scheduler.start();
    }
    return scheduler;
  }
1080276
public void start() {
    int numThreads = Runtime.getRuntime().availableProcessors();
    ThreadFactory factory = ThreadFactories.withName("ServoPollScheduler-%d");
    start(Executors.newScheduledThreadPool(numThreads, factory));
  }
624819
@Override
  public void run() {

    LOG.entering(CLASS_NAME, "run");

    try {

      LOG.log(Level.FINE, "Subscribe event handlers");

      subscribe(StartTime.class, this.startHandler.get());
      subscribe(StopTime.class, this.stopHandler.get());
      subscribe(RuntimeStart.class, this.runtimeStartHandler.get());
      subscribe(RuntimeStop.class, this.runtimeStopHandler.get());
      subscribe(IdleClock.class, this.idleHandler.get());

      LOG.log(Level.FINE, "Initiate runtime start");
      this.handlers.onNext(new RuntimeStart(this.timer.getCurrent()));

      LOG.log(Level.FINE, "Initiate start time");
      this.handlers.onNext(new StartTime(this.timer.getCurrent()));

      while (true) {

        LOG.log(Level.FINEST, "Enter clock main loop.");

        try {

          if (this.isIdle()) {
            // Handle an idle clock event, without locking this.schedule
            this.handlers.onNext(new IdleClock(this.timer.getCurrent()));
          }

          final Time event;
          final int eventQueueLen;
          synchronized (this.schedule) {

            while (this.schedule.isEmpty()) {
              this.schedule.wait();
            }

            assert this.schedule.first() != null;

            // Wait until the first scheduled time is ready.
            // NOTE: while waiting, another alarm could be scheduled with a shorter duration
            // so the next time I go around the loop I need to revise my duration.
            while (true) {
              final long waitDuration = this.timer.getDuration(this.schedule.first());
              if (waitDuration <= 0) {
                break;
              }
              this.schedule.wait(waitDuration);
            }

            // Remove the event from the schedule and process it:
            event = this.schedule.pollFirst();

            if (event instanceof ClientAlarm) {
              --this.numClientAlarms;
              assert this.numClientAlarms >= 0;
            }

            eventQueueLen = this.numClientAlarms;
          }

          assert event != null;

          LOG.log(Level.FINER,
              "Process event: {0} Outstanding client alarms: {1}", new Object[] {event, eventQueueLen});

          if (event instanceof Alarm) {
            ((Alarm) event).run();
          } else {
            this.handlers.onNext(event);
            if (event instanceof StopTime) {
              break; // we're done.
            }
          }

        } catch (final InterruptedException expected) {
          LOG.log(Level.FINEST, "Wait interrupted; continue event loop.");
        }
      }

      this.handlers.onNext(new RuntimeStop(this.timer.getCurrent(), this.exceptionCausedStop));

    } catch (final Exception e) {

      LOG.log(Level.SEVERE, "Error in runtime clock", e);
      this.handlers.onNext(new RuntimeStop(this.timer.getCurrent(), e));

    } finally {
      LOG.log(Level.FINE, "Runtime clock exit");
    }

    LOG.exiting(CLASS_NAME, "run");
  }