60 #include "rnr/rnrconfig.h" 65 #include "rnr/appkit/Random.h" 99 "Unit test liblaelaps LaeThread base class.",
102 "The %P command unit tests the liblaelap LaeThread base class operation.",
124 "Thread execution cycle hertz run rate." 138 "Do [not] randomly jitter the scheduled execution." 160 printf(
"UTThread::transToReady, state=%d\n", m_eState);
165 printf(
"UTThread::transToRunning, state=%d\n", m_eState);
170 printf(
"UTThread::transToExit, state=%d\n", m_eState);
182 f = (double)m_rand.uniform(0.0, 2.0);
183 usec = (ulong_t)(f * m_fTExec * 1000000);
191 struct termios old = {0};
194 if( tcgetattr(0, &old) < 0 )
199 old.c_lflag &= ~ICANON;
200 old.c_lflag &= ~ECHO;
204 if( tcsetattr(0, TCSANOW, &old) < 0 )
209 if( read(0, &c, 1) < 0 )
214 old.c_lflag |= ICANON;
217 if( tcsetattr(0, TCSADRAIN, &old) < 0 )
228 while( (c = getch()) == 0 );
245 Argv0 = basename(argv[0]);
259 int main(
int argc,
char* argv[])
265 printf(
"Press any key to terminate.\n\n");
Laelaps thread base class interface.
static bool_t OptsRand
thread random jitter
virtual int terminateThread()
Terminate the thread.
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.
static double OptsHz
thread hertz rate
#define APP_EC_OK
success exit code
static OptsInfo_T OptsInfo[]
Command line options information.
The <b><i>Laelaps</i></b> namespace encapsulates all <b><i>Laelaps</i></b> related constructs...
static const PkgInfo_T PkgInfo
Package version information.
virtual int createThread(int nPriority)
Create the thread.
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 runThread(const double fHz)
Run the thread.
static OptsPgmInfo_T PgmInfo
Program information.
Top-level package include file.