=== modified file 'mixxx/src/sounddeviceportaudio.cpp' --- mixxx/src/sounddeviceportaudio.cpp 2010-01-20 21:14:02 +0000 +++ mixxx/src/sounddeviceportaudio.cpp 2010-01-21 10:50:19 +0000 @@ -19,6 +19,8 @@ #include #include #include +#include +#include #include "controlobjectthreadmain.h" #include "soundmanager.h" #include "sounddevice.h" @@ -307,8 +309,35 @@ // Turn on TimeCritical priority for the callback thread. If we are running // in Linux userland, for example, this will have no effect. if(!m_bSetThreadPriority) { + int sched_policy; + sched_param param; + if (pthread_getschedparam(pthread_self(), &sched_policy, ¶m) != 0) { + // failed to get the scheduling policy, don't bother setting + // the priority + qWarning("QThread::setPriority: Cannot get scheduler parameters"); + } + int prio_min = sched_get_priority_min(sched_policy); + int prio_max = sched_get_priority_max(sched_policy); + qDebug() << "sched_policy" << sched_policy + << "priority" << param.sched_priority + << "priomin" << prio_min + << "priomax" << prio_max; + QThread::currentThread()->setPriority(QThread::TimeCriticalPriority); m_bSetThreadPriority = true; + + if (pthread_getschedparam(pthread_self(), &sched_policy, ¶m) != 0) { + // failed to get the scheduling policy, don't bother setting + // the priority + qWarning("QThread::setPriority: Cannot get scheduler parameters"); + } + prio_min = sched_get_priority_min(sched_policy); + prio_max = sched_get_priority_max(sched_policy); + qDebug() << "sched_policy" << sched_policy + << "priority" << param.sched_priority + << "priomin" << prio_min + << "priomax" << prio_max; + } //Send audio from the soundcard's input off to the SoundManager...