From e878e53cab36fb634628843ccbd7c2fbdf137850 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 25 Sep 2015 10:11:52 +0000 Subject: [PATCH] From Curtis Rubel, "I would like to submit the attached file for inclusion in future releases of OpenSceneGraph and the OpenThreads library. The changes in the file simply remove a few ifndef's that currently do not allow Linux systems to fully utilize the PThread real-time scheduling API. Since Linux now fully supports the PThread scheduling API it would be beneficial to have it available to use as necessary. I have been testing this change since OSG release 3.3.7 and have not seen any ill affects. The Priority scheduling api is further protected by another ifdef: #ifdef ALLOW_PRIORITY_SCHEDULING that only appears to be defined in the pthreads implementation as well. This would make it unlikely that anyone would be affected by this unless they are intentionally wanting to run with priority scheduling. In which case on Linux they would need to make these same modifications themselves to utilize it to its full extent. Attached file is for the current trunk as of this date. " git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15140 16af8721-9629-0410-8352-f15c8da7e697 --- src/OpenThreads/pthreads/PThread.cpp | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/OpenThreads/pthreads/PThread.cpp b/src/OpenThreads/pthreads/PThread.cpp index 72f18991f..e16ed0434 100644 --- a/src/OpenThreads/pthreads/PThread.cpp +++ b/src/OpenThreads/pthreads/PThread.cpp @@ -286,8 +286,6 @@ private: pthread_getschedparam(thread->getProcessId(), &th_policy, &th_param); -#ifndef __linux__ - switch(thread->getSchedulePolicy()) { @@ -312,24 +310,10 @@ private: break; }; -#else - th_policy = SCHED_OTHER; // Must protect linux from realtime. -#endif - -#ifdef __linux__ - - max_priority = 0; - min_priority = 20; - nominal_priority = (max_priority + min_priority)/2; - -#else - max_priority = sched_get_priority_max(th_policy); min_priority = sched_get_priority_min(th_policy); nominal_priority = (max_priority + min_priority)/2; -#endif - switch(thread->getSchedulePriority()) {