60 #include "libComAPI.h" 71 #define epicsThreadPriorityMax 99 72 #define epicsThreadPriorityMin 0 75 #define epicsThreadPriorityLow 10 76 #define epicsThreadPriorityMedium 50 77 #define epicsThreadPriorityHigh 90 80 #define epicsThreadPriorityCAServerLow 20 81 #define epicsThreadPriorityCAServerHigh 40 82 #define epicsThreadPriorityScanLow 60 83 #define epicsThreadPriorityScanHigh 70 84 #define epicsThreadPriorityIocsh 91 85 #define epicsThreadPriorityBaseMax 91 103 epicsThreadStackSizeClass size);
109 #define EPICS_THREAD_ONCE_INIT 0 167 #define EPICS_THREAD_OPTS_INIT { \ 168 epicsThreadPriorityLow, epicsThreadStackMedium, 0} 193 #define EPICS_THREAD_CAN_JOIN 207 epicsThreadId
id,
unsigned int priority);
211 LIBCOM_API epicsThreadBooleanStatus epicsStdCall
213 unsigned int priority,
unsigned *pPriorityJustBelow);
217 LIBCOM_API epicsThreadBooleanStatus epicsStdCall
219 unsigned int priority,
unsigned *pPriorityJustAbove);
222 epicsThreadId id1, epicsThreadId id2);
275 epicsThreadId
id,
char *name,
size_t size);
297 epicsThreadId
id,
unsigned int level);
350 class LIBCOM_API epicsThreadRunable {
352 virtual ~epicsThreadRunable () = 0;
356 virtual void run () = 0;
358 virtual void show (
unsigned int level )
const;
381 void start () throw ();
383 void exitWait () throw ();
387 bool exitWait ( const
double delay ) throw ();
392 void resume () throw ();
394 void getName (
char * name,
size_t size ) const throw ();
398 unsigned int getPriority () const throw ();
400 void setPriority (
unsigned int ) throw ();
401 bool priorityIsEqual ( const
epicsThread & ) const throw ();
402 bool isSuspended () const throw ();
404 bool isCurrentThread () const throw ();
405 bool operator == ( const
epicsThread & ) const throw ();
407 void show (
unsigned level ) const throw ();
410 static void suspendSelf () throw ();
411 static void sleep (
double seconds) throw ();
412 static const
char * getNameSelf () throw ();
413 static bool isOkToBlock () throw ();
414 static void setOkToBlock (
bool isOkToBlock ) throw ();
417 class unableToCreateThread;
419 epicsThreadRunable & runable;
424 bool * pThreadDestroyed;
430 bool beginWait () throw ();
432 epicsThread & operator = ( const epicsThread & );
434 void printLastChanceExceptionMessage (
435 const
char * pExceptionTypeName,
436 const
char * pExceptionContext );
438 class exitException {};
441 class LIBCOM_API epicsThreadPrivateBase {
443 class unableToCreateThreadPrivate {};
445 static void throwUnableToCreateThreadPrivate ();
449 class epicsThreadPrivate :
450 private epicsThreadPrivateBase {
452 epicsThreadPrivate ();
453 ~epicsThreadPrivate () throw ();
454 T *
get () const throw ();
455 void set (T *) throw ();
462 #include "osdThread.h" 467 inline epicsThreadPrivate<T>::epicsThreadPrivate ()
470 if ( this->
id == 0 ) {
471 epicsThreadPrivateBase::throwUnableToCreateThreadPrivate ();
476 inline epicsThreadPrivate<T>::~epicsThreadPrivate () throw ()
488 inline void epicsThreadPrivate<T>::set (T *pIn)
throw ()
LIBCOM_API unsigned int epicsStdCall epicsThreadGetPriority(epicsThreadId id)
LIBCOM_API void epicsThreadRealtimeLock(void)
LIBCOM_API void *epicsStdCall epicsThreadPrivateGet(epicsThreadPrivateId)
LIBCOM_API void epicsStdCall epicsThreadPrivateDelete(epicsThreadPrivateId id)
LIBCOM_API double epicsStdCall epicsThreadSleepQuantum(void)
Query a value approximating the OS timer/scheduler resolution.
LIBCOM_API const char *epicsStdCall epicsThreadGetNameSelf(void)
void(* EPICS_THREAD_HOOK_ROUTINE)(epicsThreadId id)
epicsThreadId epicsThreadOnceId
struct epicsThreadOSD * epicsThreadId
LIBCOM_API void epicsStdCall epicsThreadShowAll(unsigned int level)
LIBCOM_API void epicsStdCall epicsThreadShow(epicsThreadId id, unsigned int level)
LIBCOM_API int epicsStdCall epicsThreadIsEqual(epicsThreadId id1, epicsThreadId id2)
LIBCOM_API unsigned int epicsStdCall epicsThreadGetStackSize(epicsThreadStackSizeClass size)
LIBCOM_API int epicsStdCall epicsThreadIsOkToBlock(void)
LIBCOM_API int epicsThreadGetCPUs(void)
LIBCOM_API epicsThreadId epicsStdCall epicsThreadMustCreate(const char *name, unsigned int priority, unsigned int stackSize, EPICSTHREADFUNC funptr, void *parm)
LIBCOM_API void epicsStdCall epicsThreadSuspendSelf(void)
epicsThreadStackSizeClass
LIBCOM_API epicsThreadBooleanStatus epicsStdCall epicsThreadLowestPriorityLevelAbove(unsigned int priority, unsigned *pPriorityJustAbove)
struct epicsThreadPrivateOSD * epicsThreadPrivateId
APIs for the epicsMutex mutual exclusion semaphore.
LIBCOM_API void epicsStdCall epicsThreadOnce(epicsThreadOnceId *id, EPICSTHREADFUNC, void *arg)
LIBCOM_API void epicsStdCall epicsThreadPrivateSet(epicsThreadPrivateId, void *)
LIBCOM_API epicsThreadId epicsStdCall epicsThreadCreate(const char *name, unsigned int priority, unsigned int stackSize, EPICSTHREADFUNC funptr, void *parm)
#define epicsThreadPriorityLow
LIBCOM_API void epicsStdCall epicsThreadResume(epicsThreadId id)
LIBCOM_API void epicsStdCall epicsThreadExitMain(void)
LIBCOM_API void epicsStdCall epicsThreadGetName(epicsThreadId id, char *name, size_t size)
APIs for the epicsEvent binary semaphore.
LIBCOM_API epicsThreadBooleanStatus epicsStdCall epicsThreadHighestPriorityLevelBelow(unsigned int priority, unsigned *pPriorityJustBelow)
LIBCOM_API unsigned int epicsStdCall epicsThreadGetPrioritySelf(void)
struct epicsThreadOpts epicsThreadOpts
LIBCOM_API int epicsThreadHookAdd(EPICS_THREAD_HOOK_ROUTINE hook)
LIBCOM_API int epicsThreadHookDelete(EPICS_THREAD_HOOK_ROUTINE hook)
LIBCOM_API void epicsStdCall epicsThreadSleep(double seconds)
Block the calling thread for at least the specified time.
LIBCOM_API void epicsThreadMustJoin(epicsThreadId id)
LIBCOM_API epicsThreadId epicsThreadCreateOpt(const char *name, EPICSTHREADFUNC funptr, void *parm, const epicsThreadOpts *opts)
Allocate and start a new OS thread.
LIBCOM_API int epicsStdCall epicsThreadIsSuspended(epicsThreadId id)
void epicsThreadCallEntryPoint(void *pPvt)
LIBCOM_API void epicsThreadMap(EPICS_THREAD_HOOK_ROUTINE func)
LIBCOM_API epicsThreadId epicsStdCall epicsThreadGetId(const char *name)
LIBCOM_API epicsThreadPrivateId epicsStdCall epicsThreadPrivateCreate(void)
void(* EPICSTHREADFUNC)(void *parm)
LIBCOM_API void epicsThreadHooksShow(void)
LIBCOM_API void epicsStdCall epicsThreadSetPriority(epicsThreadId id, unsigned int priority)
LIBCOM_API epicsThreadId epicsStdCall epicsThreadGetIdSelf(void)
LIBCOM_API void epicsStdCall epicsThreadSetOkToBlock(int isOkToBlock)