Remove a timer from the heap, return True if already run
508520
def remove(self, timer):
        """"""
        with self.lock:
            # This is somewhat expensive as we have to heapify.
            if timer in self.timers:
                self._remove(timer)
                return False
            else:
                return True
1164598
private static synchronized boolean cancelScheduledTimeout(AsyncTimeout node) {
    // Remove the node from the linked list.
    for (AsyncTimeout prev = head; prev != null; prev = prev.next) {
      if (prev.next == node) {
        prev.next = node.next;
        node.next = null;
        return false;
      }
    }

    // The node wasn't found in the linked list: it must have timed out!
    return true;
  }
959448
public static void removeTimer(ScheduledTimer timer) {
    Preconditions.checkNotNull(timer, "timer");
    try (LockResource r = new LockResource(sLock)) {
      ScheduledTimer removedTimer = sTimers.remove(timer.getThreadName());
      Preconditions.checkNotNull(removedTimer, "sTimers should contain %s", timer.getThreadName());
      Preconditions.checkState(removedTimer == timer,
          "sTimers should contain the timer being removed");
    }
  }
883842
public int removeTimer(Object arg)
    {
        Objects.requireNonNull(arg, "Argument has to be supplied");

        //  We cannot touch self->timers because we may be executing that
        //  from inside the poll loop. So, we hold the arg on the zombie
        //  list, and process that list when we're done executing timers.
        zombies.add(arg);
        if (verbose) {
            System.out.printf("I: zloop: cancel timer\n");
        }

        return 0;
    }
177774
def _pop(self, block=True, timeout=None, left=False):
        
        item  = None
        timer = None
        deque = self._deque
        empty = IndexError('pop from an empty deque')

        if block is False:
            if len(self._deque) > 0:
                item = deque.popleft() if left else deque.pop()
            else:
                raise empty
        else:
            try:
                if timeout is not None:
                    timer = gevent.Timeout(timeout, empty)
                    timer.start()

                while True:
                    self.notEmpty.wait()
                    if len(deque) > 0:
                        item = deque.popleft() if left else deque.pop()
                        break
            finally:
                if timer is not None:
                    timer.cancel()

        if len(deque) == 0:
            self.notEmpty.clear()

        return item
631680
public static void end() {
    if (!active) return;

    TimerStack stack = curStack.get();
    if (null == stack) return;

    TimerNode currentNode = stack.pop();

    if (currentNode != null) {
      TimerNode parent = stack.peek();
      long total = currentNode.end();
      // if we are the root timer, then print out the times
      if (parent == null) {
        printTimes(currentNode);
        curStack.set(null); // for those servers that use thread pooling
      } else {
        if (total > mintime) parent.children.add(currentNode);
      }
    }
  }
410914
static function timer_delete($timer)
    {
        if (isset(self::$timers[$timer]))
        {
            unset(self::$timers[$timer]);
            return true;
        }
        return false;
    }
1140393
def _RemoveFromPool(self):
    
    with self.pool.lock:

      # Pool is shutting down, we can't interfere.
      if not self.pool.started:
        return False

      # Keep a minimum number of threads in the pool.
      if len(self.pool) <= self.pool.min_threads:
        return False

      # Remove us from our pool.
      self.pool._RemoveWorker(self.name)  # pylint: disable=protected-access

      return True
472909
public boolean cancelTimer(final long timerId)
    {
        final int wheelIndex = tickForTimerId(timerId);
        final int arrayIndex = indexInTickArray(timerId);

        if (wheelIndex < wheel.length)
        {
            final long[] array = wheel[wheelIndex];

            if (arrayIndex < array.length && NULL_TIMER != array[arrayIndex])
            {
                array[arrayIndex] = NULL_TIMER;
                timerCount--;

                return true;
            }
        }

        return false;
    }
884857
def timerEvent(self, event):
        
        if event.timerId() == self._hide_timer.timerId():
            self._hide_timer.stop()
            self.hide()
1262944
def reset(self) -> None:
        ''''''

        Log.debug('resetting timer task %s')
        self.target = self.time() + self.DELAY
903645
public static boolean discard(Source source, int timeout, TimeUnit timeUnit) {
    try {
      return skipAll(source, timeout, timeUnit);
    } catch (IOException e) {
      return false;
    }
  }
918477
def remove_listener(registry, listener):
    
    if listener is not None and listener in registry:
        registry.remove(listener)
        return True

    return False
12061
private static void purgeQueue() {

        ChronoReference cref;

        while ((cref = (ChronoReference) QUEUE.poll()) != null) {
            for (ChronoReference test : CHRONOS) {
                if (test.name.equals(cref.name)) {
                    CHRONOS.remove(test);
                    break;
                }
            }
        }

    }
1372157
def debounce(interval_s, keyed_by=None):
    """"""
    def wrapper(func):
        timers = {}
        lock = threading.Lock()

        @functools.wraps(func)
        def debounced(*args, **kwargs):
            call_args = inspect.getcallargs(func, *args, **kwargs)
            key = call_args[keyed_by] if keyed_by else None

            def run():
                with lock:
                    del timers[key]
                return func(*args, **kwargs)

            with lock:
                old_timer = timers.get(key)
                if old_timer:
                    old_timer.cancel()

                timer = threading.Timer(interval_s, run)
                timers[key] = timer
                timer.start()
        return debounced
    return wrapper
76644
def check(self):
        '''  '''
        if self.lastrun + self.interval < time.time():
            return True
        else:
            return False
334662
function(id) {
        // Stop javascript timer & remove from timer list
        if (id && timers[id]) {
            window.clearInterval(timers[id].timer);
            removeListeners(timers[id].listeners);
            delete timers[id];
        }
    }