libCom/posix: add env var to opt out of FIFO scheduling
- add EPICS_ALLOW_POSIX_THREAD_PRIORITY_SCHEDULING (default: YES) - start EPICS threads with default policy when set to NO
This commit is contained in:
committed by
Andrew Johnson
parent
b308be3273
commit
862272d666
1
modules/libcom/src/env/envDefs.h
vendored
1
modules/libcom/src/env/envDefs.h
vendored
@@ -77,6 +77,7 @@ LIBCOM_API extern const ENV_PARAM IOCSH_PS1;
|
||||
LIBCOM_API extern const ENV_PARAM IOCSH_HISTSIZE;
|
||||
LIBCOM_API extern const ENV_PARAM IOCSH_HISTEDIT_DISABLE;
|
||||
LIBCOM_API extern const ENV_PARAM EPICS_ABORT_ON_ASSERT;
|
||||
LIBCOM_API extern const ENV_PARAM EPICS_ALLOW_POSIX_THREAD_PRIORITY_SCHEDULING;
|
||||
/** @brief List of all parameters.
|
||||
*
|
||||
* A NULL terminated array of all ENV_PARAM known to EPICS Base.
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "epicsAssert.h"
|
||||
#include "epicsExit.h"
|
||||
#include "epicsAtomic.h"
|
||||
#include "envDefs.h"
|
||||
|
||||
LIBCOM_API void epicsThreadShowInfo(epicsThreadOSD *pthreadInfo, unsigned int level);
|
||||
LIBCOM_API void osdThreadHooksRun(epicsThreadId id);
|
||||
@@ -93,6 +94,7 @@ static pthread_mutex_t listLock;
|
||||
static ELLLIST pthreadList = ELLLIST_INIT;
|
||||
static commonAttr *pcommonAttr = 0;
|
||||
static int epicsThreadOnceCalled = 0;
|
||||
static int wantPrioScheduling = 0;
|
||||
|
||||
static epicsThreadOSD *createImplicit(void);
|
||||
|
||||
@@ -384,6 +386,7 @@ static void once(void)
|
||||
checkStatusOnce(status,"pthread_attr_getschedparam");
|
||||
|
||||
findPriorityRange(pcommonAttr);
|
||||
envGetBoolConfigParam(&EPICS_ALLOW_POSIX_THREAD_PRIORITY_SCHEDULING, &wantPrioScheduling);
|
||||
|
||||
if(pcommonAttr->maxPriority == -1) {
|
||||
pcommonAttr->maxPriority = pcommonAttr->schedParam.sched_priority;
|
||||
@@ -604,8 +607,10 @@ epicsThreadCreateOpt(const char * name,
|
||||
return 0;
|
||||
|
||||
pthreadInfo->isEpicsThread = 1;
|
||||
setSchedulingPolicy(pthreadInfo, SCHED_FIFO);
|
||||
pthreadInfo->isRealTimeScheduled = 1;
|
||||
if (wantPrioScheduling) {
|
||||
setSchedulingPolicy(pthreadInfo, SCHED_FIFO);
|
||||
pthreadInfo->isRealTimeScheduled = 1;
|
||||
}
|
||||
|
||||
if (pthreadInfo->joinable) {
|
||||
/* extra ref for epicsThreadMustJoin() */
|
||||
|
||||
Reference in New Issue
Block a user