]> git.sesse.net Git - nageru/commitdiff
Give all of our threads meaningful names, to aid with debugging.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 25 Jan 2017 18:20:28 +0000 (19:20 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 25 Jan 2017 18:20:28 +0000 (19:20 +0100)
alsa_pool.cpp
bmusb
decklink_capture.cpp
decklink_output.cpp
midi_mapper.cpp
mixer.cpp
quicksync_encoder.cpp

index bcda16315329e87b039a5240a015e7b050c4d5d3..3a4a5b0eddf74ff876a9c00f432f1cacb1fe5004 100644 (file)
@@ -4,6 +4,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <limits.h>
+#include <pthread.h>
 #include <poll.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -134,6 +135,10 @@ void ALSAPool::probe_device_retry_thread_func(unsigned card_index, unsigned dev_
        char address[256];
        snprintf(address, sizeof(address), "hw:%d,%d", card_index, dev_index);
 
+       char thread_name[16];
+       snprintf(thread_name, sizeof(thread_name), "Reprobe_hw:%d,%d", card_index, dev_index);
+       pthread_setname_np(pthread_self(), thread_name);
+
        for ( ;; ) {  // Termination condition within the loop.
                sleep(1);
 
@@ -288,6 +293,8 @@ void ALSAPool::init()
 
 void ALSAPool::inotify_thread_func()
 {
+       pthread_setname_np(pthread_self(), "ALSA_Hotplug");
+
        int inotify_fd = inotify_init();
        if (inotify_fd == -1) {
                perror("inotify_init()");
diff --git a/bmusb b/bmusb
index 9053593313b47bd5fd6b888bec9809bf4aacc8a9..1833f747a9008f38e5597622f2e3dbce3340e2cb 160000 (submodule)
--- a/bmusb
+++ b/bmusb
@@ -1 +1 @@
-Subproject commit 9053593313b47bd5fd6b888bec9809bf4aacc8a9
+Subproject commit 1833f747a9008f38e5597622f2e3dbce3340e2cb
index 92fd6ae296e567a402928bb3fd15a7e4f9300042..d38cc73a3ae432f62d9c368f766a74861f17622b 100644 (file)
@@ -8,6 +8,7 @@
 #ifdef __SSE2__
 #include <immintrin.h>
 #endif
+#include <pthread.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -301,6 +302,9 @@ HRESULT STDMETHODCALLTYPE DeckLinkCapture::VideoInputFrameArrived(
        IDeckLinkAudioInputPacket *audio_frame)
 {
        if (!done_init) {
+               char thread_name[16];
+               snprintf(thread_name, sizeof(thread_name), "DeckLink_C_%d", card_index);
+               pthread_setname_np(pthread_self(), thread_name);
                if (has_dequeue_callbacks) {
                        dequeue_init_callback();
                }
index c5bf96b3a0c404f0f448535d5da3fd3a286641c1..21baf618f7aba57a5bab928ee334c33cff40c6db 100644 (file)
@@ -1,6 +1,7 @@
 #include <movit/effect_util.h>
 #include <movit/util.h>
 #include <movit/resource_pool.h>  // Must be above the Xlib includes.
+#include <pthread.h>
 
 #include <epoxy/egl.h>
 
@@ -361,6 +362,7 @@ unique_ptr<DeckLinkOutput::Frame> DeckLinkOutput::get_frame()
 
 void DeckLinkOutput::present_thread_func()
 {
+       pthread_setname_np(pthread_self(), "DeckLinkOutput");
        for ( ;; ) {
                unique_ptr<Frame> frame;
                {
index 6ce50302eec560f77472cc4c372e68fd8cdd547c..d03f38211e524a2fcb85b70c96cddc4c958b46d9 100644 (file)
@@ -8,6 +8,7 @@
 #include <google/protobuf/io/zero_copy_stream_impl.h>
 #include <google/protobuf/message.h>
 #include <google/protobuf/text_format.h>
+#include <pthread.h>
 #include <poll.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -148,6 +149,8 @@ ControllerReceiver *MIDIMapper::set_receiver(ControllerReceiver *new_receiver)
 
 void MIDIMapper::thread_func()
 {
+       pthread_setname_np(pthread_self(), "MIDIMapper");
+
        snd_seq_t *seq;
        int err;
 
index b5311a32ed574354d9ac24b00246431307edff55..457734d29578d80696cb2dfdb55f22b669a5e625 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -10,6 +10,7 @@
 #include <movit/image_format.h>
 #include <movit/init.h>
 #include <movit/resource_pool.h>
+#include <pthread.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -565,6 +566,8 @@ void Mixer::bm_hotplug_remove(unsigned card_index)
 
 void Mixer::thread_func()
 {
+       pthread_setname_np(pthread_self(), "Mixer_OpenGL");
+
        eglBindAPI(EGL_OPENGL_API);
        QOpenGLContext *context = create_context(mixer_surface);
        if (!make_current(context, mixer_surface)) {
@@ -932,6 +935,8 @@ void Mixer::render_one_frame(int64_t duration)
 
 void Mixer::audio_thread_func()
 {
+       pthread_setname_np(pthread_self(), "Mixer_Audio");
+
        while (!should_quit) {
                AudioTask task;
 
index 875b264fdfe90342a0efcdfba78c38d33243ca66..f0ec210709354f621efa2f228390dca02ec8b703 100644 (file)
@@ -8,6 +8,7 @@
 #include <assert.h>
 #include <epoxy/egl.h>
 #include <fcntl.h>
+#include <pthread.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -1430,6 +1431,7 @@ void QuickSyncEncoderImpl::storage_task_enqueue(storage_task task)
 
 void QuickSyncEncoderImpl::storage_task_thread()
 {
+       pthread_setname_np(pthread_self(), "QS_Storage");
        for ( ;; ) {
                storage_task current;
                {
@@ -1723,6 +1725,8 @@ void QuickSyncEncoderImpl::open_output_file(const std::string &filename)
 
 void QuickSyncEncoderImpl::encode_thread_func()
 {
+       pthread_setname_np(pthread_self(), "QS_Encode");
+
        int64_t last_dts = -1;
        int gop_start_display_frame_num = 0;
        for (int display_frame_num = 0; ; ++display_frame_num) {