def METHOD_NAME(self, when):
    """
    Pauses the gather thread until either the gathering is supposed to happen or
    until a new earlier event was triggered, in which case all of the
    threads will wake up and one of them will reinsert their currently
    scheduled gathering onto the heap and take an earlier one.
    @return: whether `when` has been reached or not and the gather should
    occur. False indicates that there was a new earlier gathering that
    should happen and thus this thread should give up it's currently
    scheduled gathering.
    """
    secs_until_gather = when - time.time()
    while secs_until_gather > 0:
        self.new_earlier_event.wait(secs_until_gather)
        if self.stop_event.is_set():
            return True
        with self.heap_lock:
            # This means there was a more recent gather scheduled than what
            # we are currently waiting for.  In this case, we want to
            # push the scheduled gather back onto the heap and pull
            # another (which will be an earlier one).  Only one thread
            # will actually do this because of the heap lock.  The rest
            # will just go back to sleep with an updated wait time.
            if self.new_earlier_event.is_set():
                self.new_earlier_event.clear()
                return False
        secs_until_gather = when - time.time()
    return True