mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-14 19:13:49 +01:00
fixed thread priority issues on POSIX platforms with non-standard scheduling policy
This commit is contained in:
parent
fe6bf63656
commit
fbbfc507e2
@ -121,6 +121,7 @@ void ThreadImpl::setPriorityImpl(int prio)
|
|||||||
if (prio != _pData->prio)
|
if (prio != _pData->prio)
|
||||||
{
|
{
|
||||||
_pData->prio = prio;
|
_pData->prio = prio;
|
||||||
|
_pData->policy = SCHED_OTHER;
|
||||||
if (isRunningImpl())
|
if (isRunningImpl())
|
||||||
{
|
{
|
||||||
struct sched_param par;
|
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)
|
if (prio != _pData->osPrio || policy != _pData->policy)
|
||||||
{
|
{
|
||||||
@ -236,7 +237,7 @@ void ThreadImpl::startImpl(Runnable& target)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct sched_param par;
|
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))
|
if (pthread_setschedparam(_pData->thread, _pData->policy, &par))
|
||||||
throw SystemException("cannot set thread priority");
|
throw SystemException("cannot set thread priority");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user