This class provides a thread‐safe event scheduler. scheduleEvent schedules a non‐recurring event, returning a handle of type TimerEventScheduler::Handle, which can be used to cancel the scheduled event by invoking cancelEvent. Similarly, startClock schedules a recurring event, returning a handle of type TimerEventScheduler::Handle, which can be used to cancel the clock by invoking cancelClock. cancelAllEvents cancels all the registered events and cancelAllClocks cancels all the registered clocks. The callbacks are processed by a separate thread (called dispatcher thread). By default the callbacks are executed in the dispatcher thread, but this behavior can be altered by providing a dispatcher functor at the creation time (see the section "The dispatcher thread and the dispatcher functor"). start must be invoked to start dispatching the callbacks. stop stops the dispatching of the callbacks without removing the pending events.
Synopsis
Declared in <bdlmt_timereventscheduler.h>
class TimerEventScheduler;
Type Aliases
Name |
Description |
Defines a type alias for the dispatcher functor type. |
|
Defines a type alias for a user‐supplied key for identifying events. |
|
Defines a type alias for a handle that identifies a scheduled clock or event. |
Enums
Name |
Description |
Invalid handle constants. |
Member Functions
Name |
Description |
|
Constructors |
|
Stop this scheduler, discard all the unprocessed events and destroy this object. |
Cancel all clocks. If the optionally specified |
|
Cancel all the events. If the optionally specified |
|
Cancel the clock having the specified |
|
|
|
Return the value of the clock type that this object was created with. |
|
Return the earliest scheduled starting time of the pending events and clocks registered with this scheduler. If there are no pending events or clocks, return |
|
Return the current epoch time, an absolute time represented as an interval from some epoch, which is determined by the clock indicated at construction (see []Clock‐Types)). |
|
Return a snapshot of the number of registered clocks with this scheduler. |
|
Return a snapshot of the number of pending events and events being dispatched in this scheduler. |
|
|
|
Schedule the specified |
|
|
|
Schedule a recurring event that invokes the specified |
|
End the dispatching of events on this scheduler (but do not remove any pending events), and wait for any (one) currently executing event to complete. If the scheduler is already stopped then this method has no effect. This scheduler can be restarted by invoking |
|
|
Declare that this type uses a |
Friends
Name |
Description |
This class provides a means to change the clock that is used by a given event‐scheduler to determine when events should be triggered. Constructing a |
|
Dispatcher functor type for |
Created with MrDocs