|
|
Timer implementation with TimeServer support. More...
#include <ArmarXCore/core/time/Timer.h>
Inheritance diagram for Timer:Public Member Functions | |
| void | call () override |
| wakes up the execution thread to check if a task has to run | |
| bool | cancel (const IceUtil::TimerTaskPtr &task) |
| cancels a task, returns true if the task was successfully canceled (i.e. | |
| void | destroy () |
| destroys the Timer and detaches the exection thread if the calling thread is the timer thread, joins the thread otherwise | |
| bool | getUseSystemTime () const |
| void | schedule (const IceUtil::TimerTaskPtr &task, const IceUtil::Time &interval) |
| schedules a task for execution | |
| void | scheduleRepeated (const IceUtil::TimerTaskPtr &task, const IceUtil::Time &interval) |
| schedules a task for repeated execution | |
| Timer (bool forceSystemTime=false) | |
| constructs a new Timer and starts its execution thread. | |
| ~Timer () override | |
Public Member Functions inherited from CallbackReceiver | |
| virtual | ~CallbackReceiver () |
Protected Member Functions | |
| void | run () override |
| the execution thread main method | |
Protected Attributes | |
| std::mutex | callbackWaitMutex |
| used for waiting for a callback from the LocalTimeServer | |
| bool | called |
| if call() has been called. | |
| std::condition_variable | condWait |
| used for waiting for a callback from the LocalTimeServer | |
| IceUtil::TimerPtr | iceTimer |
| timer for use in system time mode | |
| bool | running |
| set to false to stop the execution thread | |
| std::vector< ScheduledTask > | scheduledTasks |
| list of scheduled tasks | |
| std::mutex | scheduledTasksMutex |
| used for locking scheduledTasks | |
| bool | useSystemTime |
| if we are using the system time (or the TimeServer time) | |
Timer implementation with TimeServer support.
The Timer class provides a timer following the same interface as IceUtil::Timer, but adding the option to use time from a TimeServer.
Using system time for scheduling is still possible using forceSystemTime=true in the constructor.
| Timer | ( | bool | forceSystemTime = false | ) |
constructs a new Timer and starts its execution thread.
| forceSystemTime | if set to true, system time will be used even if a TimeServer is available |
|
override |
|
overridevirtual |
wakes up the execution thread to check if a task has to run
Implements CallbackReceiver.
| bool cancel | ( | const IceUtil::TimerTaskPtr & | task | ) |
cancels a task, returns true if the task was successfully canceled (i.e.
was found in the queue), false otherwise
| task | task to cancel |
| void destroy | ( | ) |
| bool getUseSystemTime | ( | ) | const |
|
overrideprotected |
the execution thread main method
| void schedule | ( | const IceUtil::TimerTaskPtr & | task, |
| const IceUtil::Time & | interval ) |
schedules a task for execution
| task | the task to execute (an object extending IceUtil::TimerTask |
| interval | how long to wait before the task is run |
| void scheduleRepeated | ( | const IceUtil::TimerTaskPtr & | task, |
| const IceUtil::Time & | interval ) |
schedules a task for repeated execution
| task | the task to execute (an object extending IceUtil::TimerTask |
| interval | the interval in which the task is executed |
|
protected |
used for waiting for a callback from the LocalTimeServer
|
protected |
if call() has been called.
Used together with condWait.
|
protected |
used for waiting for a callback from the LocalTimeServer
|
protected |
timer for use in system time mode
|
protected |
set to false to stop the execution thread
|
protected |
list of scheduled tasks
|
protected |
used for locking scheduledTasks
|
protected |
if we are using the system time (or the TimeServer time)