50 #include <sys/types.h> 57 #include "rnr/rnrconfig.h" 105 LaeThread(
const std::string &strThreadName);
162 virtual void setHz(
const double fHz);
223 pthread_mutex_lock(&m_mutexSync);
237 pthread_mutex_unlock(&m_mutexSync);
261 void timedWait(
const struct timespec &tsTimeout);
346 static void *
thread(
void *pArg);
352 #endif // _LAE_THREAD_H virtual void transToRunning()
Ready to Running state transition function.
thread created but unitialized
virtual int terminateThread()
Terminate the thread.
pthread_t m_thread
pthread identifier
void unlock()
Unlock the I2C bus.
ThreadState m_eState
thread state
int m_nSlipErrCnt
slipped error count leaky bucket
LaeThread(const std::string &strThreadName)
Default constructor.
virtual void transToExit()
Any to Exit state transition function.
pthread_mutex_t m_mutexSync
synchonization mutex
void lock()
Lock the I2C bus.
int m_nPriority
thread OS scheduling priority
ThreadState
Kinematics thread states.
std::string m_strThreadName
thread identifying name
static void * thread(void *pArg)
The thread.
static const int ThreadPriorityMax
maximum scheduling priority
virtual void readyBlock()
Block indefinitely while in the ready state.
virtual ~LaeThread()
Destructor.
struct timespec m_tsExecThis
start of this execution time stamp
struct timespec m_tsSched
working scheduler time stamp
thread created and blocked, ready to start
The <b><i>Laelaps</i></b> namespace encapsulates all <b><i>Laelaps</i></b> related constructs...
virtual void schedBlock()
Block the thread until the next subcycle task is to be run.
double m_fTExec
task execution cycle period (seconds)
Laelaps common utilities.
virtual void exec()
Execute task(s) within scheduled [sub]cycle.
virtual void setHz(const double fHz)
Calculate thread new full cycle run rate.
virtual int createThread(int nPriority)
Create the thread.
std::string getThreadName() const
Get assigned thread name.
int getThreadPriority() const
Get thread system scheduling priority.
void timedWait(const struct timespec &tsTimeout)
Timed wait until state change or time out.
virtual void transToReady()
Uninitialized to Ready state transition function.
double m_fHz
thread cycle run rate (Hertz)
static const double ThreadMinHz
minimum thread Hertz
double getThreadHz() const
Get thread run full cycle rate.
struct timespec m_tsExecPeriod
task execution period (converted)
virtual int runThread(const double fHz)
Run the thread.
pthread_cond_t m_condSync
synchonization condition
void changeState(ThreadState eNewState)
Change the thread state.
struct timespec m_tsJitter
allowable scheduling jitter
struct timespec m_tsExecLast
start of last execution time stamp
Top-level package include file.
static const int ThreadPriorityMin
minimum scheduling priority