27#include <condition_variable>
31#include <IceUtil/Handle.h>
32#include <IceUtil/Shared.h>
33#include <IceUtil/Thread.h>
34#include <IceUtil/Time.h>
35#include <IceUtil/Timer.h>
43 IceUtil::TimerTaskPtr
task;
59 public virtual IceUtil::Shared,
60 private virtual IceUtil::Thread,
68 Timer(
bool forceSystemTime =
false);
85 void schedule(
const IceUtil::TimerTaskPtr& task,
const IceUtil::Time&
interval);
100 bool cancel(
const IceUtil::TimerTaskPtr& task);
105 void call()
override;
Used by CallbackWaitLock.
Timer(bool forceSystemTime=false)
constructs a new Timer and starts its execution thread.
std::vector< ScheduledTask > scheduledTasks
list of scheduled tasks
bool useSystemTime
if we are using the system time (or the TimeServer time)
std::condition_variable condWait
used for waiting for a callback from the LocalTimeServer
std::mutex scheduledTasksMutex
used for locking scheduledTasks
bool running
set to false to stop the execution thread
void destroy()
destroys the Timer and detaches the exection thread if the calling thread is the timer thread,...
bool called
if call() has been called.
bool cancel(const IceUtil::TimerTaskPtr &task)
cancels a task, returns true if the task was successfully canceled (i.e.
bool getUseSystemTime() const
void call() override
wakes up the execution thread to check if a task has to run
void run() override
the execution thread main method
IceUtil::TimerPtr iceTimer
timer for use in system time mode
std::mutex callbackWaitMutex
used for waiting for a callback from the LocalTimeServer
void scheduleRepeated(const IceUtil::TimerTaskPtr &task, const IceUtil::Time &interval)
schedules a task for repeated execution
void schedule(const IceUtil::TimerTaskPtr &task, const IceUtil::Time &interval)
schedules a task for execution
IceUtil::Handle< Timer > TimerPtr
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< Timer > TimerPtr
smart pointer for armarx::Timer
Interval< T > interval(T lo, T hi)
IceUtil::TimerTaskPtr task