BloombergLP::bdlmt::TimerEventScheduler::startClock

Schedule a recurring callback at the specified interval.

Synopsis

Declared in <bdlmt_timereventscheduler.h>

Handle
startClock(
    bsls::TimeInterval const& interval,
    bsl::function<void()> const& callback,
    bsls::TimeInterval const& startTime = bsls::TimeInterval(0));

Description

Schedule a recurring event that invokes the specified callback at every specified interval, starting at the optionally specified startTime. On success, return a handle that can be use to cancel the clock (by invoking cancelClock), or return e_INVALID_HANDLE if scheduling this event would exceed the maximum number of scheduled events for this object (see constructor). If no start time is specified, it is assumed to be the interval time from now. The startTime is an absolute time represented as an interval from some epoch, which is detemined by the clock indicated at construction (see []Clock-Types)).

Return Value

a handle for the clock, or e_INVALID_HANDLE if the limit is exceeded

Parameters

NameDescription
intervalperiod between recurring invocations
callbackfunction invoked at each interval
startTimefirst invocation time; the default is interval from now