61 #include "libComAPI.h" 67 typedef void (*EPICSTHREADFUNC)(
void *parm);
72 #define epicsThreadPriorityMax 99 73 #define epicsThreadPriorityMin 0 76 #define epicsThreadPriorityLow 10 77 #define epicsThreadPriorityMedium 50 78 #define epicsThreadPriorityHigh 90 81 #define epicsThreadPriorityCAServerLow 20 82 #define epicsThreadPriorityCAServerHigh 40 83 #define epicsThreadPriorityScanLow 60 84 #define epicsThreadPriorityScanHigh 70 85 #define epicsThreadPriorityIocsh 91 86 #define epicsThreadPriorityBaseMax 91 91 epicsThreadStackSmall, epicsThreadStackMedium, epicsThreadStackBig
95 epicsThreadBooleanStatusFail, epicsThreadBooleanStatusSuccess
96 } epicsThreadBooleanStatus;
104 epicsThreadStackSizeClass size);
109 typedef epicsThreadId epicsThreadOnceId;
110 #define EPICS_THREAD_ONCE_INIT 0 131 epicsThreadOnceId *
id, EPICSTHREADFUNC,
void *arg);
168 #define EPICS_THREAD_OPTS_INIT { \ 169 epicsThreadPriorityLow, epicsThreadStackMedium, 0} 180 EPICSTHREADFUNC funptr,
void * parm,
185 EPICSTHREADFUNC funptr,
void * parm );
191 EPICSTHREADFUNC funptr,
void * parm );
194 #define EPICS_THREAD_CAN_JOIN 208 epicsThreadId
id,
unsigned int priority);
212 LIBCOM_API epicsThreadBooleanStatus epicsStdCall
214 unsigned int priority,
unsigned *pPriorityJustBelow);
218 LIBCOM_API epicsThreadBooleanStatus epicsStdCall
220 unsigned int priority,
unsigned *pPriorityJustAbove);
223 epicsThreadId id1, epicsThreadId id2);
276 epicsThreadId
id,
char *name,
size_t size);
298 epicsThreadId
id,
unsigned int level);
357 virtual void run () = 0;
359 virtual void show (
unsigned int level )
const;
362 extern "C" void epicsThreadCallEntryPoint (
void * );
379 unsigned int priority=epicsThreadPriorityLow );
382 void start ()
throw ();
384 void exitWait ()
throw ();
388 bool exitWait (
const double delay )
throw ();
393 void resume ()
throw ();
395 void getName (
char * name,
size_t size )
const throw ();
397 epicsThreadId getId ()
const throw ();
399 unsigned int getPriority ()
const throw ();
401 void setPriority (
unsigned int )
throw ();
402 bool priorityIsEqual (
const epicsThread & )
const throw ();
403 bool isSuspended ()
const throw ();
405 bool isCurrentThread ()
const throw ();
406 bool operator == (
const epicsThread & )
const throw ();
408 void show (
unsigned level )
const throw ();
411 static void suspendSelf ()
throw ();
412 static void sleep (
double seconds)
throw ();
413 static const char * getNameSelf ()
throw ();
414 static bool isOkToBlock ()
throw ();
415 static void setOkToBlock (
bool isOkToBlock )
throw ();
418 class unableToCreateThread;
425 bool * pThreadDestroyed;
431 bool beginWait ()
throw ();
434 friend void epicsThreadCallEntryPoint (
void * );
435 void printLastChanceExceptionMessage (
436 const char * pExceptionTypeName,
437 const char * pExceptionContext );
439 class exitException {};
446 static void throwUnableToCreateThreadPrivate ();
455 T *
get ()
const throw ();
456 void set (T *)
throw ();
463 #include "osdThread.h" 471 if ( this->
id == 0 ) {
472 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 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 epicsThreadExitMain(void)
LIBCOM_API void epicsStdCall epicsThreadSetOkToBlock(int isOkToBlock)
LIBCOM_API void epicsThreadHooksShow(void)
LIBCOM_API void epicsStdCall epicsThreadOnce(epicsThreadOnceId *id, EPICSTHREADFUNC, void *arg)
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)
void(* EPICS_THREAD_HOOK_ROUTINE)(epicsThreadId id)
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.