Applied linux-runtime-disable-RT-priorities-if-not-supported.patch

This commit is contained in:
Andrew Johnson
2015-02-20 12:25:28 -06:00
parent a6af0daae9
commit a437768c9c
+8
View File
@@ -57,6 +57,7 @@ typedef struct commonAttr{
int maxPriority;
int minPriority;
int schedPolicy;
int usePolicy;
} commonAttr;
typedef struct epicsThreadOSD {
@@ -79,6 +80,7 @@ typedef struct epicsThreadOSD {
typedef struct {
int min_pri, max_pri;
int policy;
int ok;
} priAvailable;
#endif
@@ -138,6 +140,8 @@ static void setSchedulingPolicy(epicsThreadOSD *pthreadInfo,int policy)
#if defined (_POSIX_THREAD_PRIORITY_SCHEDULING)
int status;
if(!pcommonAttr->usePolicy) return;
status = pthread_attr_getschedparam(
&pthreadInfo->attr,&pthreadInfo->schedParam);
checkStatusOnce(status,"pthread_attr_getschedparam");
@@ -278,6 +282,7 @@ int low, try;
prm->min_pri = min;
prm->max_pri = try_pri(max, prm->policy) ? max-1 : max;
prm->ok = 1;
return 0;
}
@@ -290,6 +295,7 @@ void *dummy;
int status;
arg.policy = a_p->schedPolicy;
arg.ok = 0;
status = pthread_create(&id, 0, find_pri_range, &arg);
checkStatusQuit(status, "pthread_create","epicsThreadInit");
@@ -299,6 +305,7 @@ int status;
a_p->minPriority = arg.min_pri;
a_p->maxPriority = arg.max_pri;
a_p->usePolicy = arg.ok;
}
#endif
@@ -608,6 +615,7 @@ epicsShareFunc void epicsShareAPI epicsThreadSetPriority(epicsThreadId pthreadIn
pthreadInfo->osiPriority = priority;
if(!pthreadInfo->isFifoScheduled) return;
#if defined (_POSIX_THREAD_PRIORITY_SCHEDULING)
if(!pcommonAttr->usePolicy) return;
pthreadInfo->schedParam.sched_priority = getOssPriorityValue(pthreadInfo);
status = pthread_attr_setschedparam(
&pthreadInfo->attr,&pthreadInfo->schedParam);