Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Attributes | List of all members
RTT::extras::TimerThread Class Reference

#include <TimerThread.hpp>

Inheritance diagram for RTT::extras::TimerThread:
Inheritance graph
[legend]

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 ()
 
- Public Member Functions inherited from RTT::os::Thread
virtual unsigned getCpuAffinity () const
 
virtual int getMaxOverrun () const
 
virtual const char * getName () const
 
void getPeriod (secs &s, nsecs &ns) const
 
virtual Seconds getPeriod () const
 
virtual nsecs getPeriodNS () const
 
virtual unsigned int getPid () const
 
virtual int getPriority () const
 
virtual int getScheduler () const
 
Seconds getStopTimeout () const
 
virtual RTOS_TASKgetTask ()
 
virtual const RTOS_TASKgetTask () const
 
virtual bool isActive () const
 
virtual bool isPeriodic () const
 
virtual bool isRunning () const
 
virtual bool setCpuAffinity (unsigned cpu_affinity)
 
virtual void setMaxOverrun (int m)
 
bool setPeriod (Seconds s)
 
bool setPeriod (secs s, nsecs ns)
 
bool setPeriod (TIME_SPEC p)
 
virtual bool setPriority (int priority)
 
virtual bool setScheduler (int sched_type)
 
void setStopTimeout (Seconds s)
 
virtual void setWaitPeriodPolicy (int p)
 
virtual bool start ()
 
virtual bool stop ()
 
 Thread (int scheduler, int priority, double period, unsigned cpu_affinity, const std::string &name)
 
virtual void yield ()
 
virtual ~Thread ()
 
- Public Member Functions inherited from RTT::os::ThreadInterface
bool isSelf () const
 
 ThreadInterface ()
 
unsigned int threadNumber () const
 
virtual ~ThreadInterface ()
 

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 Member Functions inherited from RTT::os::Thread
static void setLockTimeoutNoPeriod (double timeout_in_s)
 
static void setLockTimeoutPeriodFactor (double factor)
 
static void setStackSize (unsigned int ssize)
 

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 Member Functions inherited from RTT::os::Thread
virtual bool breakLoop ()
 
void emergencyStop ()
 
virtual void loop ()
 
void terminate ()
 

Protected Attributes

os::MutexRecursive mutex
 
- Protected Attributes inherited from RTT::os::Thread
bool active
 
MutexRecursive breaker
 
bool inloop
 
int maxOverRun
 
int msched_type
 
NANO_TIME period
 
bool prepareForExit
 
RTOS_TASK rtos_task
 
bool running
 
rt_sem_t sem
 
double stopTimeout
 
- Protected Attributes inherited from RTT::os::ThreadInterface
int threadnb
 

Static Protected Attributes

static TimerThreadList TimerThreads
 
- Static Protected Attributes inherited from RTT::os::Thread
static unsigned int default_stack_size = 0
 
static double lock_timeout_no_period_in_s = 1.0
 
static double lock_timeout_period_factor = 10.0
 

Private Types

typedef std::vector< PeriodicActivity * > ActivityList
 

Private Attributes

bool cleanup
 
ActivityList tasks
 

Detailed Description

This Periodic Thread is meant for executing a PeriodicActivity object periodically.

See also
PeriodicActivity

Definition at line 69 of file TimerThread.hpp.

Member Typedef Documentation

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.

Constructor & Destructor Documentation

RTT::TimerThread::TimerThread ( int  priority,
const std::string &  name,
double  periodicity,
unsigned  cpu_affinity = ~0 
)

Create a periodic Timer thread.

Parameters
priorityThe priority of this thread
periodicityThe periodicity of this thread in seconds (e.g. 0.001 = 1000Hz )

Definition at line 95 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.

Parameters
schedulerThe scheduler in which this thread runs
priorityThe priority of this thread within scheduler
periodicityThe periodicity of this thread in seconds (e.g. 0.001 = 1000Hz )

Definition at line 101 of file TimerThread.cpp.

RTT::TimerThread::~TimerThread ( )
virtual

Destructor

Definition at line 107 of file TimerThread.cpp.

Member Function Documentation

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 113 of file TimerThread.cpp.

void RTT::TimerThread::finalize ( )
protectedvirtual
See also
base::RunnableInterface::finalize()

Reimplemented from RTT::os::Thread.

Reimplemented in RTT::extras::SimulationThread.

Definition at line 140 of file TimerThread.cpp.

bool RTT::TimerThread::initialize ( )
protectedvirtual
See also
base::RunnableInterface::initialize()

Reimplemented from RTT::os::Thread.

Reimplemented in RTT::extras::SimulationThread.

Definition at line 136 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 57 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 62 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 67 of file TimerThread.cpp.

bool RTT::TimerThread::removeActivity ( PeriodicActivity t)

Definition at line 124 of file TimerThread.cpp.

void RTT::TimerThread::reorderList ( )
protected

Definition at line 166 of file TimerThread.cpp.

void RTT::TimerThread::step ( )
protectedvirtual
See also
base::RunnableInterface::step()

Reimplemented from RTT::os::Thread.

Reimplemented in RTT::extras::SimulationThread.

Definition at line 150 of file TimerThread.cpp.

Member Data Documentation

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
mutableprotected

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
staticprotected

All timer threads.

Definition at line 145 of file TimerThread.hpp.


The documentation for this class was generated from the following files:


rtt
Author(s): RTT Developers
autogenerated on Fri Oct 25 2019 03:59:46