|
Timer implementation with TimeServer support. More...
#include <ArmarXCore/core/time/Timer.h>
Public Member Functions | |
void | call () override |
wakes up the execution thread to check if a task has to run More... | |
bool | cancel (const IceUtil::TimerTaskPtr &task) |
cancels a task, returns true if the task was successfully canceled (i.e. More... | |
void | destroy () |
destroys the Timer and detaches the exection thread if the calling thread is the timer thread, joins the thread otherwise More... | |
bool | getUseSystemTime () const |
void | schedule (const IceUtil::TimerTaskPtr &task, const IceUtil::Time &interval) |
schedules a task for execution More... | |
void | scheduleRepeated (const IceUtil::TimerTaskPtr &task, const IceUtil::Time &interval) |
schedules a task for repeated execution More... | |
Timer (bool forceSystemTime=false) | |
constructs a new Timer and starts its execution thread. More... | |
~Timer () override | |
Public Member Functions inherited from CallbackReceiver | |
virtual | ~CallbackReceiver () |
Protected Member Functions | |
void | run () override |
the execution thread main method More... | |
Protected Attributes | |
std::mutex | callbackWaitMutex |
used for waiting for a callback from the LocalTimeServer More... | |
bool | called |
if call() has been called. More... | |
std::condition_variable | condWait |
used for waiting for a callback from the LocalTimeServer More... | |
IceUtil::TimerPtr | iceTimer |
timer for use in system time mode More... | |
bool | running |
set to false to stop the execution thread More... | |
std::vector< ScheduledTask > | scheduledTasks |
list of scheduled tasks More... | |
std::mutex | scheduledTasksMutex |
used for locking scheduledTasks More... | |
bool | useSystemTime |
if we are using the system time (or the TimeServer time) More... | |
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 | ) |
|
override |
|
overridevirtual |
wakes up the execution thread to check if a task has to run
Implements CallbackReceiver.
Definition at line 143 of file Timer.cpp.
bool cancel | ( | const IceUtil::TimerTaskPtr & | task | ) |
void destroy | ( | ) |
destroys the Timer and detaches the exection thread if the calling thread is the timer thread, joins the thread otherwise
The Timer must not be used to schedule anything new after a call to destroy()
!
Definition at line 157 of file Timer.cpp.
bool getUseSystemTime | ( | ) | const |
|
overrideprotected |
void schedule | ( | const IceUtil::TimerTaskPtr & | task, |
const IceUtil::Time & | interval | ||
) |
void scheduleRepeated | ( | const IceUtil::TimerTaskPtr & | task, |
const IceUtil::Time & | interval | ||
) |
|
protected |
used for waiting for a callback from the LocalTimeServer
|
protected |
|
protected |
used for waiting for a callback from the LocalTimeServer
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |