61 #include "libComAPI.h"
68 typedef void (*EPICSTHREADFUNC)(
void *parm);
73 #define epicsThreadPriorityMax 99
74 #define epicsThreadPriorityMin 0
77 #define epicsThreadPriorityLow 10
78 #define epicsThreadPriorityMedium 50
79 #define epicsThreadPriorityHigh 90
82 #define epicsThreadPriorityCAServerLow 20
83 #define epicsThreadPriorityCAServerHigh 40
84 #define epicsThreadPriorityScanLow 60
85 #define epicsThreadPriorityScanHigh 70
86 #define epicsThreadPriorityIocsh 91
87 #define epicsThreadPriorityBaseMax 91
92 epicsThreadStackSmall, epicsThreadStackMedium, epicsThreadStackBig
96 epicsThreadBooleanStatusFail, epicsThreadBooleanStatusSuccess
97 } epicsThreadBooleanStatus;
110 typedef epicsThreadId epicsThreadOnceId;
111 #define EPICS_THREAD_ONCE_INIT 0
132 epicsThreadOnceId *
id, EPICSTHREADFUNC,
void *arg);
173 #define EPICS_THREAD_OPTS_INIT { \
174 epicsThreadPriorityLow, epicsThreadStackMedium, 0}
185 EPICSTHREADFUNC funptr,
void * parm,
189 const char * name,
unsigned int priority,
unsigned int stackSize,
190 EPICSTHREADFUNC funptr,
void * parm );
195 const char * name,
unsigned int priority,
unsigned int stackSize,
196 EPICSTHREADFUNC funptr,
void * parm );
199 #define EPICS_THREAD_CAN_JOIN
213 epicsThreadId
id,
unsigned int priority);
217 LIBCOM_API epicsThreadBooleanStatus epicsStdCall
219 unsigned int priority,
unsigned *pPriorityJustBelow);
223 LIBCOM_API epicsThreadBooleanStatus epicsStdCall
225 unsigned int priority,
unsigned *pPriorityJustAbove);
228 epicsThreadId id1, epicsThreadId id2);
281 epicsThreadId
id,
char *name,
size_t size);
303 epicsThreadId
id,
unsigned int level);
362 virtual void run () = 0;
364 virtual void show (
unsigned int level )
const;
367 extern "C" void epicsThreadCallEntryPoint (
void * );
384 unsigned int priority=epicsThreadPriorityLow );
387 void start ()
throw ();
389 void exitWait ()
throw ();
393 bool exitWait (
const double delay )
throw ();
398 void resume ()
throw ();
400 void getName (
char * name,
size_t size )
const throw ();
402 epicsThreadId getId ()
const throw ();
404 unsigned int getPriority ()
const throw ();
406 void setPriority (
unsigned int )
throw ();
407 bool priorityIsEqual (
const epicsThread & )
const throw ();
408 bool isSuspended ()
const throw ();
410 bool isCurrentThread ()
const throw ();
411 bool operator == (
const epicsThread & )
const throw ();
413 void show (
unsigned level )
const throw ();
416 static void suspendSelf ()
throw ();
417 static void sleep (
double seconds)
throw ();
418 static const char * getNameSelf ()
throw ();
419 static bool isOkToBlock ()
throw ();
420 static void setOkToBlock (
bool isOkToBlock )
throw ();
423 class unableToCreateThread;
430 bool * pThreadDestroyed;
436 bool beginWait ()
throw ();
439 friend void epicsThreadCallEntryPoint (
void * );
440 void printLastChanceExceptionMessage (
441 const char * pExceptionTypeName,
442 const char * pExceptionContext );
444 class exitException {};
451 static void throwUnableToCreateThreadPrivate ();
460 T *
get ()
const throw ();
461 void set (T *)
throw ();
468 #include "osdThread.h"
476 if ( this->
id == 0 ) {
477 epicsThreadPrivateBase::throwUnableToCreateThreadPrivate ();
LIBCOM_API void epicsStdCall epicsThreadSetPriority(epicsThreadId id, unsigned int priority)
LIBCOM_API unsigned int epicsStdCall epicsThreadGetPriority(epicsThreadId id)
LIBCOM_API void epicsThreadMap(EPICS_THREAD_HOOK_ROUTINE func)
LIBCOM_API epicsThreadId epicsStdCall epicsThreadGetIdSelf(void)
LIBCOM_API void epicsStdCall epicsThreadExitMain(void) EPICS_DEPRECATED
LIBCOM_API epicsThreadBooleanStatus epicsStdCall epicsThreadLowestPriorityLevelAbove(unsigned int priority, unsigned *pPriorityJustAbove)
LIBCOM_API int epicsStdCall epicsThreadIsOkToBlock(void)
APIs for the epicsEvent binary semaphore.
LIBCOM_API epicsThreadBooleanStatus epicsStdCall epicsThreadHighestPriorityLevelBelow(unsigned int priority, unsigned *pPriorityJustBelow)
LIBCOM_API int epicsStdCall epicsThreadIsSuspended(epicsThreadId id)
LIBCOM_API void epicsThreadRealtimeLock(void)
LIBCOM_API unsigned int epicsStdCall epicsThreadGetPrioritySelf(void)
epicsThreadStackSizeClass
LIBCOM_API int epicsStdCall epicsThreadIsEqual(epicsThreadId id1, epicsThreadId id2)
LIBCOM_API void epicsStdCall epicsThreadSleep(double seconds)
Block the calling thread for at least the specified time.
LIBCOM_API epicsThreadPrivateId epicsStdCall epicsThreadPrivateCreate(void)
LIBCOM_API void epicsStdCall epicsThreadSetOkToBlock(int isOkToBlock)
LIBCOM_API void epicsThreadHooksShow(void)
Compiler specific declarations.
LIBCOM_API void epicsStdCall epicsThreadOnce(epicsThreadOnceId *id, EPICSTHREADFUNC, void *arg)
void(* EPICS_THREAD_HOOK_ROUTINE)(epicsThreadId id)
LIBCOM_API epicsThreadId epicsStdCall epicsThreadMustCreate(const char *name, unsigned int priority, unsigned int stackSize, EPICSTHREADFUNC funptr, void *parm)
LIBCOM_API int epicsThreadHookDelete(EPICS_THREAD_HOOK_ROUTINE hook)
LIBCOM_API int epicsThreadGetCPUs(void)
The C++ API for an epicsMutex.
LIBCOM_API void epicsStdCall epicsThreadPrivateSet(epicsThreadPrivateId, void *)
LIBCOM_API int epicsThreadHookAdd(EPICS_THREAD_HOOK_ROUTINE hook)
LIBCOM_API void epicsThreadMustJoin(epicsThreadId id)
LIBCOM_API void epicsStdCall epicsThreadResume(epicsThreadId id)
LIBCOM_API void epicsStdCall epicsThreadShow(epicsThreadId id, unsigned int level)
LIBCOM_API epicsThreadId epicsThreadCreateOpt(const char *name, EPICSTHREADFUNC funptr, void *parm, const epicsThreadOpts *opts)
Allocate and start a new OS thread.
struct epicsThreadPrivateOSD * epicsThreadPrivateId
LIBCOM_API epicsThreadId epicsStdCall epicsThreadCreate(const char *name, unsigned int priority, unsigned int stackSize, EPICSTHREADFUNC funptr, void *parm)
LIBCOM_API void *epicsStdCall epicsThreadPrivateGet(epicsThreadPrivateId)
APIs for the epicsMutex mutual exclusion semaphore.
Interface used with class epicsThread.
LIBCOM_API epicsThreadId epicsStdCall epicsThreadGetId(const char *name)
LIBCOM_API const char *epicsStdCall epicsThreadGetNameSelf(void)
LIBCOM_API void epicsStdCall epicsThreadPrivateDelete(epicsThreadPrivateId id)
LIBCOM_API void epicsStdCall epicsThreadShowAll(unsigned int level)
LIBCOM_API void epicsStdCall epicsThreadSuspendSelf(void)
LIBCOM_API unsigned int epicsStdCall epicsThreadGetStackSize(epicsThreadStackSizeClass size)
LIBCOM_API void epicsStdCall epicsThreadGetName(epicsThreadId id, char *name, size_t size)
LIBCOM_API double epicsStdCall epicsThreadSleepQuantum(void)
Query a value approximating the OS timer/scheduler resolution.