40 #include "rnr/rnrconfig.h" 76 "Unit test librnr_appkit Thread base class.",
79 "The %P command unit tests the librnr_appkit Thread base class operation.",
101 "Thread execution cycle hertz run rate." 115 "Do [not] randomly jitter the scheduled execution." 137 printf(
"UTThread::transToReady, state=%d\n", m_eState);
142 printf(
"UTThread::transToRunning, state=%d\n", m_eState);
147 printf(
"UTThread::transToExit, state=%d\n", m_eState);
159 f = (double)m_rand.
uniform(0.0, 2.0);
160 usec = (ulong_t)(f * m_fTExec * 1000000);
168 struct termios old = {0};
171 if( tcgetattr(0, &old) < 0 )
176 old.c_lflag &= ~ICANON;
177 old.c_lflag &= ~ECHO;
181 if( tcsetattr(0, TCSANOW, &old) < 0 )
186 if( read(0, &c, 1) < 0 )
191 old.c_lflag |= ICANON;
194 if( tcsetattr(0, TCSADRAIN, &old) < 0 )
205 while( (c = getch()) == 0 );
222 Argv0 = basename(argv[0]);
236 int main(
int argc,
char* argv[])
242 printf(
"Press any key to terminate.\n\n");
static bool_t OptsRand
thread random jitter
static char * Argv0
the command
virtual void transToReady()
Uninitialized to Ready state transition function.
virtual void transToRunning()
Ready to Running state transition function.
virtual void exec()
Execute task(s) within scheduled [sub]cycle.
float uniform(float fMin=0.0, float fMax=1.0)
Generates a random float uniformally distrubuted between [fMin, fMax].
virtual int runThread(const double fHz)
Run the thread.
static double OptsHz
thread hertz rate
Thread base class interface.
#define APP_EC_OK
success exit code
static OptsInfo_T OptsInfo[]
Command line options information.
virtual int createThread(int nPriority)
Create the thread.
static const PkgInfo_T PkgInfo
Random variable generator class interface.
Random variable generators class.
Package version information.
virtual void transToExit()
Any to Exit state transition function.
static void mainInit(int argc, char *argv[])
Main initialization.
int main(int argc, char *argv[])
Main.
virtual int terminateThread()
Terminate the thread.
static OptsPgmInfo_T PgmInfo
Program information.