From a437768c9c4bd58a8267ab8842540a30160ebdc4 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 20 Feb 2015 12:25:28 -0600 Subject: [PATCH] Applied linux-runtime-disable-RT-priorities-if-not-supported.patch --- src/libCom/osi/os/posix/osdThread.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libCom/osi/os/posix/osdThread.c b/src/libCom/osi/os/posix/osdThread.c index 30583e162..0f1523549 100644 --- a/src/libCom/osi/os/posix/osdThread.c +++ b/src/libCom/osi/os/posix/osdThread.c @@ -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);