#include <TimerThread.hpp>
Public Member Functions | |
bool | addActivity (PeriodicActivity *t) |
bool | removeActivity (PeriodicActivity *t) |
TimerThread (int priority, const std::string &name, double periodicity, unsigned cpu_affinity=~0) | |
TimerThread (int scheduler, int priority, const std::string &name, double periodicity, unsigned cpu_affinity=~0) | |
virtual | ~TimerThread () |
Static Public Member Functions | |
static TimerThreadPtr | Instance (int priority, double periodicity) |
static TimerThreadPtr | Instance (int scheduler, int priority, double periodicity) |
static TimerThreadPtr | Instance (int scheduler, int priority, double periodicity, unsigned cpu_affinity) |
Static Public Attributes | |
static const unsigned int | MAX_ACTIVITIES = 64 |
Protected Types | |
typedef std::vector < boost::weak_ptr< TimerThread > > | TimerThreadList |
Protected Member Functions | |
virtual void | finalize () |
virtual bool | initialize () |
void | reorderList () |
virtual void | step () |
Protected Attributes | |
os::MutexRecursive | mutex |
Static Protected Attributes | |
static TimerThreadList | TimerThreads |
Private Types | |
typedef std::vector < PeriodicActivity * > | ActivityList |
Private Attributes | |
bool | cleanup |
ActivityList | tasks |
This Periodic Thread is meant for executing a PeriodicActivity object periodically.
Definition at line 69 of file TimerThread.hpp.
typedef std::vector<PeriodicActivity*> RTT::extras::TimerThread::ActivityList [private] |
Definition at line 72 of file TimerThread.hpp.
typedef std::vector< boost::weak_ptr<TimerThread> > RTT::extras::TimerThread::TimerThreadList [protected] |
A Boost weak pointer is used to store non-owning pointers to shared objects.
Definition at line 140 of file TimerThread.hpp.
RTT::TimerThread::TimerThread | ( | int | priority, |
const std::string & | name, | ||
double | periodicity, | ||
unsigned | cpu_affinity = ~0 |
||
) |
Create a periodic Timer thread.
priority | The priority of this thread |
periodicity | The periodicity of this thread in seconds (e.g. 0.001 = 1000Hz ) |
Definition at line 90 of file TimerThread.cpp.
RTT::TimerThread::TimerThread | ( | int | scheduler, |
int | priority, | ||
const std::string & | name, | ||
double | periodicity, | ||
unsigned | cpu_affinity = ~0 |
||
) |
Create a periodic Timer thread with a given scheduler type.
scheduler | The scheduler in which this thread runs |
priority | The priority of this thread within scheduler |
periodicity | The periodicity of this thread in seconds (e.g. 0.001 = 1000Hz ) |
Definition at line 96 of file TimerThread.cpp.
RTT::TimerThread::~TimerThread | ( | ) | [virtual] |
Destructor
Definition at line 102 of file TimerThread.cpp.
bool RTT::TimerThread::addActivity | ( | PeriodicActivity * | t | ) |
Add an Timer that will be ticked every execution period Once added, a timer can not be removed.
Definition at line 108 of file TimerThread.cpp.
void RTT::TimerThread::finalize | ( | ) | [protected, virtual] |
Reimplemented from RTT::os::Thread.
Reimplemented in RTT::extras::SimulationThread.
Definition at line 135 of file TimerThread.cpp.
bool RTT::TimerThread::initialize | ( | ) | [protected, virtual] |
Reimplemented from RTT::os::Thread.
Reimplemented in RTT::extras::SimulationThread.
Definition at line 131 of file TimerThread.cpp.
TimerThreadPtr RTT::TimerThread::Instance | ( | int | priority, |
double | periodicity | ||
) | [static] |
Create a TimerThread with a given priority and periodicity, using the default scheduler, ORO_SCHED_RT.
Definition at line 56 of file TimerThread.cpp.
TimerThreadPtr RTT::TimerThread::Instance | ( | int | scheduler, |
int | priority, | ||
double | periodicity | ||
) | [static] |
Create a TimerThread with a given scheduler, priority and periodicity.
Definition at line 61 of file TimerThread.cpp.
TimerThreadPtr RTT::TimerThread::Instance | ( | int | scheduler, |
int | priority, | ||
double | periodicity, | ||
unsigned | cpu_affinity | ||
) | [static] |
Create a TimerThread with a given scheduler, priority and periodicity.
Definition at line 66 of file TimerThread.cpp.
bool RTT::TimerThread::removeActivity | ( | PeriodicActivity * | t | ) |
Definition at line 119 of file TimerThread.cpp.
void RTT::TimerThread::reorderList | ( | ) | [protected] |
Definition at line 158 of file TimerThread.cpp.
void RTT::TimerThread::step | ( | ) | [protected, virtual] |
Reimplemented from RTT::os::Thread.
Reimplemented in RTT::extras::SimulationThread.
Definition at line 145 of file TimerThread.cpp.
bool RTT::extras::TimerThread::cleanup [private] |
Definition at line 74 of file TimerThread.hpp.
const unsigned int RTT::extras::TimerThread::MAX_ACTIVITIES = 64 [static] |
Definition at line 76 of file TimerThread.hpp.
os::MutexRecursive RTT::extras::TimerThread::mutex [mutable, protected] |
A Activity can not create a activity of same priority from step(). If so a deadlock will occur.
Definition at line 134 of file TimerThread.hpp.
ActivityList RTT::extras::TimerThread::tasks [private] |
Definition at line 73 of file TimerThread.hpp.
TimerThread::TimerThreadList RTT::TimerThread::TimerThreads [static, protected] |
All timer threads.
Definition at line 145 of file TimerThread.hpp.