Exemple #1
0
void ThreadImpl::setOSPriorityImpl(int prio, int policy) {
    if (prio != _pData->osPrio || policy != _pData->policy) {
        if (_pData->pRunnableTarget || _pData->pCallbackTarget) {
            struct sched_param par;
            par.sched_priority = prio;
            if (pthread_setschedparam(_pData->thread, policy, &par))
                throw SystemException("cannot set thread priority");
        }
        _pData->prio   = reverseMapPrio(prio, policy);
        _pData->osPrio = prio;
        _pData->policy = policy;
    }
}
Exemple #2
0
void ThreadImpl::setOSPriorityImpl(int prio, int /* policy */)
{
    if (prio != _pData->osPrio)
    {
        _pData->prio   = reverseMapPrio(prio);
        _pData->osPrio = prio;
        if (_pData->pRunnableTarget || _pData->pCallbackTarget)
        {
            if (taskPrioritySet(_pData->task, prio) != OK)
                throw SystemException("cannot set task priority");
        }
    }
}