YARP
Yet Another Robot Platform
ThreadedTimer Class Reference
+ Inheritance diagram for ThreadedTimer:

Public Member Functions

 ThreadedTimer (const TimerSettings &sett, const TimerCallback &call, yarp::os::Mutex *mutex)
 
 ThreadedTimer (const TimerSettings &sett, const TimerCallback &call, std::mutex *mutex=nullptr)
 
 ~ThreadedTimer () override
 
bool startTimer () override
 
bool stepTimer () override
 
void stopTimer () override
 
bool timerIsRunning () override
 
- Public Member Functions inherited from yarp::os::Timer::PrivateImpl
 PrivateImpl (const TimerSettings &sett, TimerCallback call, yarp::os::Mutex *mutex)
 
 PrivateImpl (const TimerSettings &sett, TimerCallback call, std::mutex *mutex=nullptr)
 
virtual ~PrivateImpl ()=default
 
- Public Member Functions inherited from yarp::os::PeriodicThread
 PeriodicThread (double period, ShouldUseSystemClock useSystemClock=ShouldUseSystemClock::No)
 Constructor. More...
 
virtual ~PeriodicThread ()
 
bool start ()
 Call this to start the thread. More...
 
void step ()
 Call this to "step" the thread rather than starting it. More...
 
void stop ()
 Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() called). More...
 
void askToStop ()
 Stop the thread. More...
 
bool isRunning () const
 Returns true when the thread is started, false otherwise. More...
 
bool isSuspended () const
 Returns true when the thread is suspended, false otherwise. More...
 
bool setPeriod (double period)
 Set the (new) period of the thread. More...
 
double getPeriod () const
 Return the current period of the thread. More...
 
void suspend ()
 Suspend the thread, the thread keeps running by doLoop is never executed. More...
 
void resume ()
 Resume the thread if previously suspended. More...
 
void resetStat ()
 Reset thread statistics. More...
 
double getEstimatedPeriod () const
 Return estimated period since last reset. More...
 
void getEstimatedPeriod (double &av, double &std) const
 Return estimated period since last reset. More...
 
unsigned int getIterations () const
 Return the number of iterations performed since last reset. More...
 
double getEstimatedUsed () const
 Return the estimated duration of the run() function since last reset. More...
 
void getEstimatedUsed (double &av, double &std) const
 Return estimated duration of the run() function since last reset. More...
 
int setPriority (int priority, int policy=-1)
 Set the priority and scheduling policy of the thread, if the OS supports that. More...
 
int getPriority () const
 Query the current priority of the thread, if the OS supports that. More...
 
int getPolicy () const
 Query the current scheduling policy of the thread, if the OS supports that. More...
 

Additional Inherited Members

- Public Types inherited from yarp::os::Timer::PrivateImpl
using TimerCallback = yarp::os::Timer::TimerCallback
 
- Public Attributes inherited from yarp::os::Timer::PrivateImpl
TimerSettings m_settings
 
TimerCallback m_callback
 
double m_startStamp {0.0}
 
double m_lastReal {0.0}
 
std::mutex * m_mutex {nullptr}
 
yarp::os::Mutexm_old_mutex {nullptr}
 
- Protected Member Functions inherited from yarp::os::Timer::PrivateImpl
yarp::os::YarpTimerEvent getEventNow (unsigned int iteration)
 
bool runTimer (unsigned int iteration, YarpTimerEvent event)
 
- Protected Member Functions inherited from yarp::os::PeriodicThread
virtual void threadRelease ()
 Release method. More...
 
virtual void beforeStart ()
 Called just before a new thread starts. More...
 
virtual void afterStart (bool success)
 Called just after a new thread starts (or fails to start), this is executed by the same thread that calls start(). More...
 

Detailed Description

Definition at line 266 of file Timer.cpp.

Constructor & Destructor Documentation

◆ ThreadedTimer() [1/2]

ThreadedTimer::ThreadedTimer ( const TimerSettings sett,
const TimerCallback call,
yarp::os::Mutex mutex 
)
inline

Definition at line 279 of file Timer.cpp.

◆ ThreadedTimer() [2/2]

ThreadedTimer::ThreadedTimer ( const TimerSettings sett,
const TimerCallback call,
std::mutex *  mutex = nullptr 
)
inline

Definition at line 289 of file Timer.cpp.

◆ ~ThreadedTimer()

ThreadedTimer::~ThreadedTimer ( )
inlineoverride

Definition at line 297 of file Timer.cpp.

Member Function Documentation

◆ startTimer()

bool ThreadedTimer::startTimer ( )
inlineoverridevirtual

Implements yarp::os::Timer::PrivateImpl.

Definition at line 302 of file Timer.cpp.

◆ stepTimer()

bool ThreadedTimer::stepTimer ( )
inlineoverridevirtual

Implements yarp::os::Timer::PrivateImpl.

Definition at line 309 of file Timer.cpp.

◆ stopTimer()

void ThreadedTimer::stopTimer ( )
inlineoverridevirtual

Implements yarp::os::Timer::PrivateImpl.

Definition at line 316 of file Timer.cpp.

◆ timerIsRunning()

bool ThreadedTimer::timerIsRunning ( )
inlineoverridevirtual

Implements yarp::os::Timer::PrivateImpl.

Definition at line 321 of file Timer.cpp.


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