fixed thread priority issues on POSIX platforms with non-standard scheduling policy

This commit is contained in:
Guenter Obiltschnig 2014-04-14 17:50:46 +02:00
parent fe6bf63656
commit fbbfc507e2

View File

@ -121,6 +121,7 @@ void ThreadImpl::setPriorityImpl(int prio)
if (prio != _pData->prio)
{
_pData->prio = prio;
_pData->policy = SCHED_OTHER;
if (isRunningImpl())
{
struct sched_param par;
@ -132,7 +133,7 @@ void ThreadImpl::setPriorityImpl(int prio)
}
void ThreadImpl::setOSPriorityImpl(int prio, int policy )
void ThreadImpl::setOSPriorityImpl(int prio, int policy)
{
if (prio != _pData->osPrio || policy != _pData->policy)
{
@ -236,7 +237,7 @@ void ThreadImpl::startImpl(Runnable& target)
else
{
struct sched_param par;
par.sched_priority = mapPrio(_pData->prio, _pData->policy);
par.sched_priority = _pData->osPrio;
if (pthread_setschedparam(_pData->thread, _pData->policy, &par))
throw SystemException("cannot set thread priority");
}