BloombergLP::bdlmt::TimerEventScheduler::scheduleEvent

Schedule the specified callback to run at the specified time.

Synopsis

Declared in <bdlmt_timereventscheduler.h>

Handle
scheduleEvent(
    bsls::TimeInterval const& time,
    bsl::function<void()> const& callback,
    EventKey const& key = EventKey(0));

Description

Schedule the specified callback to be dispatched at the specified time. On success, return a handle that can be used to cancel the callback (by invoking cancelEvent), or return e_INVALID_HANDLE if scheduling this event would exceed the maximum number of scheduled events for this object (see constructor). Optionally specify key to uniquely identify the event. The time 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 event, or e_INVALID_HANDLE if the limit is exceeded

Parameters

NameDescription
timeabsolute time at which to dispatch the callback
callbackfunction to invoke at time
keyoptional key uniquely identifying the event