YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
ThreadedTimer Class Reference
+ Inheritance diagram for ThreadedTimer:

Public Member Functions

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

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}
 
- 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.
 
virtual void beforeStart ()
 Called just before a new thread starts.
 
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().
 

Detailed Description

Definition at line 217 of file Timer.cpp.

Constructor & Destructor Documentation

◆ ThreadedTimer()

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

Definition at line 227 of file Timer.cpp.

◆ ~ThreadedTimer()

ThreadedTimer::~ThreadedTimer ( )
inlineoverride

Definition at line 235 of file Timer.cpp.

Member Function Documentation

◆ startTimer()

bool ThreadedTimer::startTimer ( )
inlineoverridevirtual

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

Definition at line 240 of file Timer.cpp.

◆ stepTimer()

bool ThreadedTimer::stepTimer ( )
inlineoverridevirtual

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

Definition at line 247 of file Timer.cpp.

◆ stopTimer()

void ThreadedTimer::stopTimer ( )
inlineoverridevirtual

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

Definition at line 254 of file Timer.cpp.

◆ timerIsRunning()

bool ThreadedTimer::timerIsRunning ( )
inlineoverridevirtual

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

Definition at line 259 of file Timer.cpp.


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