]> git.sesse.net Git - nageru/commitdiff
Give the ALSA threads names.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 6 Mar 2019 17:51:31 +0000 (18:51 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 6 Mar 2019 17:51:31 +0000 (18:51 +0100)
Patch by Yann Dubreuil, from the BreizhCamp repository.

nageru/alsa_input.cpp
nageru/alsa_input.h

index 40fba43c12a19192a0c0fdcc07f430355df88619..511dda95738cd63b2dcdd30ff1ae67f5bc318ff6 100644 (file)
@@ -174,6 +174,14 @@ void ALSAInput::stop_capture_thread()
 
 void ALSAInput::capture_thread_func()
 {
+       if (!done_init) {
+               char thread_name[16];
+               snprintf(thread_name, sizeof(thread_name), "ALSA_C_%d", internal_dev_index);
+               pthread_setname_np(pthread_self(), thread_name);
+
+               done_init = true;
+       }
+
        parent_pool->set_card_state(internal_dev_index, ALSAPool::Device::State::STARTING);
 
        // If the device hasn't been opened already, we need to do so
index 825d4b686d05c11a6ffddcb17510f61a9f361dbe..22420b9134c970442e7112020425f519faf161dd 100644 (file)
@@ -48,6 +48,7 @@ public:
        static bool set_base_params(const char *device_name, snd_pcm_t *pcm_handle, snd_pcm_hw_params_t *hw_params, unsigned *sample_rate);
 
 private:
+       bool done_init = false;
        void capture_thread_func();
 
        enum class CaptureEndReason {