diff --git a/airtaudio/api/Alsa.cpp b/airtaudio/api/Alsa.cpp index 46a952b..a751376 100644 --- a/airtaudio/api/Alsa.cpp +++ b/airtaudio/api/Alsa.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -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(); } diff --git a/airtaudio/api/Core.cpp b/airtaudio/api/Core.cpp index fb02060..b59b19b 100644 --- a/airtaudio/api/Core.cpp +++ b/airtaudio/api/Core.cpp @@ -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(_userData); myClass->stopStream(); } diff --git a/airtaudio/api/Ds.cpp b/airtaudio/api/Ds.cpp index 1342053..a6ea440 100644 --- a/airtaudio/api/Ds.cpp +++ b/airtaudio/api/Ds.cpp @@ -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(_userData); while (myClass->m_private->threadRunning == true) { myClass->callbackEvent(); diff --git a/airtaudio/api/Jack.cpp b/airtaudio/api/Jack.cpp index d5a1548..beba7cf 100644 --- a/airtaudio/api/Jack.cpp +++ b/airtaudio/api/Jack.cpp @@ -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(_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(_userData); myClass->stopStream(); } diff --git a/airtaudio/api/Oss.cpp b/airtaudio/api/Oss.cpp index 1f91613..3f0bad5 100644 --- a/airtaudio/api/Oss.cpp +++ b/airtaudio/api/Oss.cpp @@ -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(_userData); while (myClass->m_private->threadRunning == true) { myClass->callbackEvent(); diff --git a/airtaudio/api/Pulse.cpp b/airtaudio/api/Pulse.cpp index 03b88ce..fd1e3dc 100644 --- a/airtaudio/api/Pulse.cpp +++ b/airtaudio/api/Pulse.cpp @@ -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(); }