[DEV] update thread set priority
This commit is contained in:
parent
e873a44615
commit
102a4e5ca5
@ -13,6 +13,7 @@
|
||||
#include <airtaudio/Interface.h>
|
||||
#include <airtaudio/debug.h>
|
||||
#include <etk/stdTools.h>
|
||||
#include <etk/thread/tools.h>
|
||||
#include <limits.h>
|
||||
#include <airtaudio/api/Alsa.h>
|
||||
|
||||
@ -827,33 +828,7 @@ bool airtaudio::api::Alsa::probeDeviceOpenName(const std::string& _deviceName,
|
||||
ATA_ERROR("creating callback thread!");
|
||||
goto error;
|
||||
}
|
||||
int retcode;
|
||||
int policy;
|
||||
pthread_t threadID = (pthread_t) m_private->thread->native_handle();
|
||||
struct sched_param param;
|
||||
if ((retcode = pthread_getschedparam(threadID, &policy, ¶m)) != 0) {
|
||||
ATA_ERROR("pthread_getschedparam " << retcode);
|
||||
} else {
|
||||
ATA_WARNING("INHERITED: ");
|
||||
ATA_WARNING(" policy=" << ((policy == SCHED_FIFO) ? "SCHED_FIFO" :
|
||||
(policy == SCHED_RR) ? "SCHED_RR" :
|
||||
(policy == SCHED_OTHER) ? "SCHED_OTHER" :
|
||||
"???") );
|
||||
ATA_WARNING(" priority=" << param.sched_priority);
|
||||
}
|
||||
policy = SCHED_FIFO;
|
||||
param.sched_priority = 6;
|
||||
if ((retcode = pthread_setschedparam(threadID, policy, ¶m)) != 0) {
|
||||
ATA_ERROR("pthread_setschedparam " << retcode);
|
||||
} else {
|
||||
ATA_WARNING("Change: ");
|
||||
ATA_WARNING(" policy=" << ((policy == SCHED_FIFO) ? "SCHED_FIFO" :
|
||||
(policy == SCHED_RR) ? "SCHED_RR" :
|
||||
(policy == SCHED_OTHER) ? "SCHED_OTHER" :
|
||||
"???") );
|
||||
ATA_WARNING(" priority=" << param.sched_priority);
|
||||
}
|
||||
|
||||
etk::thread::setPriority(*m_private->thread, -6);
|
||||
}
|
||||
return true;
|
||||
error:
|
||||
@ -1069,7 +1044,7 @@ void airtaudio::api::Alsa::alsaCallbackEvent(void *_userData) {
|
||||
}
|
||||
|
||||
void airtaudio::api::Alsa::callbackEvent() {
|
||||
etk::log::setThreadName("Alsa IO-" + m_name);
|
||||
etk::thread::setName("Alsa IO-" + m_name);
|
||||
while (m_private->threadRunning == true) {
|
||||
callbackEventOneCycle();
|
||||
}
|
||||
|
@ -1003,7 +1003,7 @@ enum airtaudio::error airtaudio::api::Core::abortStream() {
|
||||
// callbackEvent() function probably should return before the AudioDeviceStop()
|
||||
// function is called.
|
||||
void airtaudio::api::Core::coreStopStream(void *_userData) {
|
||||
etk::log::setThreadName("CoreAudio_stopStream");
|
||||
etk::thread::setName("CoreAudio_stopStream");
|
||||
airtaudio::api::Core* myClass = reinterpret_cast<airtaudio::api::Core*>(_userData);
|
||||
myClass->stopStream();
|
||||
}
|
||||
|
@ -1328,7 +1328,7 @@ unlock:
|
||||
}
|
||||
|
||||
void airtaudio::api::Ds::dsCallbackEvent(void *_userData) {
|
||||
etk::log::setThreadName("DS IO-" + m_name);
|
||||
etk::thread::setName("DS IO-" + m_name);
|
||||
airtaudio::api::Ds* myClass = reinterpret_cast<airtaudio::api::Ds*>(_userData);
|
||||
while (myClass->m_private->threadRunning == true) {
|
||||
myClass->callbackEvent();
|
||||
|
@ -231,7 +231,7 @@ int32_t airtaudio::api::Jack::jackCallbackHandler(jack_nframes_t _nframes, void*
|
||||
// it this way because the jackShutdown() function must return before
|
||||
// the jack_deactivate() function (in closeStream()) will return.
|
||||
void airtaudio::api::Jack::jackCloseStream(void* _userData) {
|
||||
etk::log::setThreadName("Jack_closeStream");
|
||||
etk::thread::setName("Jack_closeStream");
|
||||
airtaudio::api::Jack* myClass = reinterpret_cast<airtaudio::api::Jack*>(_userData);
|
||||
myClass->closeStream();
|
||||
}
|
||||
@ -623,7 +623,7 @@ enum airtaudio::error airtaudio::api::Jack::abortStream() {
|
||||
// callbackEvent() function must return before the jack_deactivate()
|
||||
// function will return.
|
||||
static void jackStopStream(void* _userData) {
|
||||
etk::log::setThreadName("Jack_stopStream");
|
||||
etk::thread::setName("Jack_stopStream");
|
||||
airtaudio::api::Jack* myClass = reinterpret_cast<airtaudio::api::Jack*>(_userData);
|
||||
myClass->stopStream();
|
||||
}
|
||||
|
@ -818,7 +818,7 @@ unlock:
|
||||
}
|
||||
|
||||
static void ossCallbackHandler(void* _userData) {
|
||||
etk::log::setThreadName("OSS callback-" + m_name);
|
||||
etk::thread::setName("OSS callback-" + m_name);
|
||||
airtaudio::api::Alsa* myClass = reinterpret_cast<airtaudio::api::Oss*>(_userData);
|
||||
while (myClass->m_private->threadRunning == true) {
|
||||
myClass->callbackEvent();
|
||||
|
@ -106,7 +106,7 @@ static void pulseaudio_callback(void* _userData) {
|
||||
}
|
||||
|
||||
void airtaudio::api::Pulse::callbackEvent() {
|
||||
etk::log::setThreadName("Pulse IO-" + m_name);
|
||||
etk::thread::setName("Pulse IO-" + m_name);
|
||||
while (m_private->threadRunning == true) {
|
||||
callbackEventOneCycle();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user