BloombergLP::bdlmt::EventScheduler::scheduleRecurringEvent

Schedule a recurring event that invokes the specified callback at every specified interval truncated to microseconds, with the first event dispatched at the optionally specified startEpochTime truncated to microseconds. If startEpochTime is not specified, the first event is dispatched at one interval from now. Load into the optionally specified event a handle that can be used to cancel the event (by invoking cancelEvent). The startEpochTime is an absolute time represented as an interval from some epoch, which is determined by the clock associated with the time point. The behavior is undefined unless interval is at least one microsecond. Note that if startEpochTime is in the past, the first event is dispatched immediately, and additional (now() - startEpochTime) / interval events will be submitted serially.

Synopsis

Declared in <bdlmt_eventscheduler.h>

template<
    class t_CLOCK,
    class t_REP_TYPE,
    class t_PERIOD_TYPE,
    class t_DURATION>
void
scheduleRecurringEvent(
    bsl::chrono::duration<t_REP_TYPE, t_PERIOD_TYPE> const& interval,
    bsl::function<void()> const& callback,
    bsl::chrono::time_point<t_CLOCK, t_DURATION> const& startEpochTime = t_CLOCK::now());