Run runnable repeatedly with the given delay between calls, after the given
initial delay. Exceptions are caught and logged as errors.
422926
public static void scheduleWithFixedDelay(
      final ScheduledExecutorService exec,
      final Duration initialDelay,
      final Duration delay,
      final Runnable runnable
  )
  {
    scheduleWithFixedDelay(
        exec,
        initialDelay,
        delay,
        new Callable<Signal>()
        {
          @Override
          public Signal call()
          {
            runnable.run(); // (Exceptions are handled for us)
            return Signal.REPEAT;
          }
        }
    );
  }
593129
def run(self) -> None:
        """"""
        while self._running:
            try:
                future, function = self._tx.get(timeout=0.1)
            except Empty:
                continue

            try:
                LOG.debug("executing %s", function)
                result = function()
                LOG.debug("returning %s", result)
                self._loop.call_soon_threadsafe(future.set_result, result)
            except BaseException as e:
                LOG.exception("returning exception %s", e)
                self._loop.call_soon_threadsafe(future.set_exception, e)
132543
@Override
    public void run()
    {
        if (!running.compareAndSet(false, true))
        {
            throw new IllegalStateException("Thread is already running");
        }
        sequenceBarrier.clearAlert();

        notifyStart();

        boolean processedSequence = true;
        long cachedAvailableSequence = Long.MIN_VALUE;
        long nextSequence = sequence.get();
        T event = null;
        while (true)
        {
            try
            {
                // if previous sequence was processed - fetch the next sequence and set
                // that we have successfully processed the previous sequence
                // typically, this will be true
                // this prevents the sequence getting too far forward if an exception
                // is thrown from the WorkHandler
                if (processedSequence)
                {
                    processedSequence = false;
                    do
                    {
                        nextSequence = workSequence.get() + 1L;
                        sequence.set(nextSequence - 1L);
                    }
                    while (!workSequence.compareAndSet(nextSequence - 1L, nextSequence));
                }

                if (cachedAvailableSequence >= nextSequence)
                {
                    event = ringBuffer.get(nextSequence);
                    workHandler.onEvent(event);
                    processedSequence = true;
                }
                else
                {
                    cachedAvailableSequence = sequenceBarrier.waitFor(nextSequence);
                }
            }
            catch (final TimeoutException e)
            {
                notifyTimeout(sequence.get());
            }
            catch (final AlertException ex)
            {
                if (!running.get())
                {
                    break;
                }
            }
            catch (final Throwable ex)
            {
                // handle, mark as processed, unless the exception handler threw an exception
                exceptionHandler.handleEventException(ex, nextSequence, event);
                processedSequence = true;
            }
        }

        notifyShutdown();

        running.set(false);
    }
1368127
async def awaitable_runner(runner: BaseRunner):
    """"""
    runner_thread = CapturingThread(target=runner.run)
    runner_thread.start()
    delay = 0.0
    while not runner_thread.join(timeout=0):
        await asyncio.sleep(delay)
        delay = min(delay + 0.1, 1.0)
360583
public void run(Runnable runnable)
    {
        if (this.goForward())
        {
            for (int i = this.from; i <= this.to; i += this.step)
            {
                runnable.run();
            }
        }
        else
        {
            for (int i = this.from; i >= this.to; i += this.step)
            {
                runnable.run();
            }
        }
    }
761205
public static void run(final Runnable runnableWork,
            final long timeoutInSec) {
        ExecutorService threadPool = Executors.newFixedThreadPool(2);
        afterTimeout(timeoutInSec, threadPool, threadPool.submit(runnableWork));
    }
277519
@Override
  public void run() {
    try {
      barrier.await();
      rv = callable.call();
    } catch (Throwable t) {
      throwable = t;
    }
    latch.countDown();
  }
929911
def runAndWait(self):
        
        if self._inLoop:
            raise RuntimeError('run loop already started')
        self._inLoop = True
        self._driverLoop = True
        self.proxy.runAndWait()
189264
public static void run(final @Nonnull ThrowingRunnable runnable) {
    Objects.requireNonNull(runnable, "runnable must not be null");
    try {
      runnable.run();
    } catch (final RuntimeException exc) {
      throw exc;
    } catch (final Exception exc) {
      throw new RuntimeException(exc);
    }
  }
435341
def run(self):
        
        while True:
            try:
                self._callback(self.wait_read_frame())
            except ThreadQuitException:
                # Expected termintation of thread due to self.halt()
                break
            except Exception as e:
                # Unexpected thread quit.
                if self._error_callback:
                    self._error_callback(e)
381330
def run(self, once=False):
        """"""
        self._once = once
        self.start()
        while self.running:
            try:
                time.sleep(1.0)
            except KeyboardInterrupt:
                self.stop()
                self.join()
512672
def run(self, *, delay=None):
        
        self.broker.enqueue(self.messages[0], delay=delay)
        return self
1047873
def run(self):
        
        self.pre_run()
        first = True
        while self.runnable:
            self.pre_call_message()

            if first:
                self.pre_first_call_message()
            
            message, payload = self.listener.get()
            getattr(self, message)(payload)

            if first:
                first = False
                self.post_first_call_message()
                
            self.post_call_message()

        self.post_run()
273243
public synchronized void start() {
        if (future == null) {
            Runnable task = new Runnable() {
                                public void run() {
                                    try {
                                        accumulator.publish();
                                    } catch (Exception e) {
                                        handleException(e);
                                    }
                                }
                            };
            future = getExecutor().scheduleWithFixedDelay(task,
                                                          delayMillis, delayMillis,
                                                          TimeUnit.MILLISECONDS);
        }
    }
960104
public void run(Runnable runnable, Executor executor)
    {
        if (this.goForward())
        {
            for (int i = this.from; i <= this.to; i += this.step)
            {
                executor.execute(runnable);
            }
        }
        else
        {
            for (int i = this.from; i >= this.to; i += this.step)
            {
                executor.execute(runnable);
            }
        }
    }
758796
public static void scheduleAtFixedRate(
      final ScheduledExecutorService exec,
      final Duration initialDelay,
      final Duration period,
      final Runnable runnable
  )
  {
    scheduleAtFixedRate(exec, initialDelay, period, new Callable<Signal>()
    {
      @Override
      public Signal call()
      {
        runnable.run();
        return Signal.REPEAT;
      }
    });
  }
278149
def iterate(self, delay=None):
        
        self.runUntilCurrent()
        self.doEvents()
        self.doIteration(delay)