[vlc-devel] [PATCH 2/4] core: set names to threads created in the core

Steve Lhomme robux4 at ycbcr.xyz
Mon Nov 9 15:28:22 CET 2020


---
 src/input/decoder.c                 | 2 ++
 src/input/demux_chained.c           | 2 ++
 src/input/es_out_timeshift.c        | 2 ++
 src/input/input.c                   | 4 ++++
 src/input/vlm.c                     | 4 +++-
 src/misc/addons.c                   | 4 ++++
 src/misc/executor.c                 | 2 ++
 src/misc/update.c                   | 4 ++++
 src/network/httpd.c                 | 2 ++
 src/player/player.c                 | 2 ++
 src/posix/getaddrinfo.c             | 2 ++
 src/posix/timer.c                   | 2 ++
 src/stream_output/sap.c             | 2 ++
 src/video_output/video_output.c     | 2 ++
 src/video_output/vout_subpictures.c | 2 ++
 src/win32/mta_holder.h              | 2 ++
 16 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 793c7e687f9..a509d885ae9 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1584,6 +1584,8 @@ static void *DecoderThread( void *p_data )
     vlc_tick_t delay = 0;
     bool paused = false;
 
+    vlc_thread_set_name("vlc-decoder");
+
     /* The decoder's main loop */
     vlc_fifo_Lock( p_owner->p_fifo );
 
diff --git a/src/input/demux_chained.c b/src/input/demux_chained.c
index c8c436daec3..4b5bae72aec 100644
--- a/src/input/demux_chained.c
+++ b/src/input/demux_chained.c
@@ -53,6 +53,8 @@ struct vlc_demux_chained_t
 
 static void *vlc_demux_chained_Thread(void *data)
 {
+    vlc_thread_set_name("vlc-demux-chain");
+
     vlc_demux_chained_t *dc = data;
     demux_t *demux = demux_New(VLC_OBJECT(dc->reader), dc->name, dc->reader,
                                dc->out);
diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index 3239e8e9c2e..eb82f07648a 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -1089,6 +1089,8 @@ static int TsChangeRate( ts_thread_t *p_ts, float src_rate, float rate )
 
 static void *TsRun( void *p_data )
 {
+    vlc_thread_set_name("vlc-timeshift");
+
     ts_thread_t *p_ts = p_data;
     vlc_tick_t i_buffering_date = -1;
 
diff --git a/src/input/input.c b/src/input/input.c
index 4be4d304f61..af104e30ade 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -464,6 +464,8 @@ static void *Run( void *data )
     input_thread_private_t *priv = data;
     input_thread_t *p_input = &priv->input;
 
+    vlc_thread_set_name("vlc-input");
+
     vlc_interrupt_set(&priv->interrupt);
 
     if( !Init( p_input ) )
@@ -490,6 +492,8 @@ static void *Preparse( void *data )
     input_thread_private_t *priv = data;
     input_thread_t *p_input = &priv->input;
 
+    vlc_thread_set_name("vlc-input-preparse");
+
     vlc_interrupt_set(&priv->interrupt);
 
     if( !Init( p_input ) )
diff --git a/src/input/vlm.c b/src/input/vlm.c
index 116fc5296e3..cc4be6110ad 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -239,6 +239,8 @@ int vlm_ExecuteCommand( vlm_t *p_vlm, const char *psz_command,
  *****************************************************************************/
 static void* Manage( void* p_object )
 {
+    vlc_thread_set_name("vlc-vlm");
+
     vlm_t *vlm = (vlm_t*)p_object;
     time_t lastcheck;
     bool exiting;
@@ -774,7 +776,7 @@ static int vlm_ControlMediaInstanceGetTimePosition( vlm_t *p_vlm, int64_t id, co
 
     vlc_player_Lock(p_instance->player);
     if( pi_time )
-        *pi_time = US_FROM_VLC_TICK(vlc_player_GetTime(p_instance->player)); 
+        *pi_time = US_FROM_VLC_TICK(vlc_player_GetTime(p_instance->player));
     if( pd_position )
         *pd_position = vlc_player_GetPosition(p_instance->player);
     vlc_player_Unlock(p_instance->player);
diff --git a/src/misc/addons.c b/src/misc/addons.c
index 49a0f324638..bde2c273cb0 100644
--- a/src/misc/addons.c
+++ b/src/misc/addons.c
@@ -330,6 +330,8 @@ static void finder_thread_interrupted( void* p_data )
 
 static void *FinderThread( void *p_data )
 {
+    vlc_thread_set_name("vlc-addons-finder");
+
     addons_manager_t *p_manager = p_data;
     int i_cancel = vlc_savecancel();
     vlc_interrupt_set( p_manager->p_priv->finder.p_interrupt );
@@ -456,6 +458,8 @@ static void installer_thread_interrupted( void* p_data )
 
 static void *InstallerThread( void *p_data )
 {
+    vlc_thread_set_name("vlc-addons-installer");
+
     addons_manager_t *p_manager = p_data;
     int i_cancel = vlc_savecancel();
     vlc_interrupt_set( p_manager->p_priv->installer.p_interrupt );
diff --git a/src/misc/executor.c b/src/misc/executor.c
index 3b79f9ba8d3..d1a137b6f9f 100644
--- a/src/misc/executor.c
+++ b/src/misc/executor.c
@@ -119,6 +119,8 @@ ThreadRun(void *userdata)
     struct vlc_executor_thread *thread = userdata;
     vlc_executor_t *executor = thread->owner;
 
+    vlc_thread_set_name("vlc-executor-runner");
+
     vlc_mutex_lock(&executor->lock);
 
     struct vlc_runnable *runnable;
diff --git a/src/misc/update.c b/src/misc/update.c
index a4c9349153a..8477a0779bc 100644
--- a/src/misc/update.c
+++ b/src/misc/update.c
@@ -412,6 +412,8 @@ void update_Check( update_t *p_update, void (*pf_callback)( void*, bool ), void
 
 void* update_CheckReal( void *obj )
 {
+    vlc_thread_set_name("vlc-updater-check");
+
     update_check_thread_t *p_uct = (update_check_thread_t *)obj;
     bool b_ret;
     int canc;
@@ -524,6 +526,8 @@ void update_Download( update_t *p_update, const char *psz_destdir )
 
 static void* update_DownloadReal( void *obj )
 {
+    vlc_thread_set_name("vlc-updater-download");
+
     update_download_thread_t *p_udt = (update_download_thread_t *)obj;
     uint64_t l_size;
     uint64_t l_downloaded = 0;
diff --git a/src/network/httpd.c b/src/network/httpd.c
index 52c8e5bdf3e..0026a609ed2 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -2057,6 +2057,8 @@ static void httpdLoop(httpd_host_t *host)
 
 static void* httpd_HostThread(void *data)
 {
+    vlc_thread_set_name("vlc-httpd");
+
     httpd_host_t *host = data;
 
     while (atomic_load_explicit(&host->ref, memory_order_relaxed) > 0)
diff --git a/src/player/player.c b/src/player/player.c
index c4ba5b120dd..a4fabb07c9c 100644
--- a/src/player/player.c
+++ b/src/player/player.c
@@ -200,6 +200,8 @@ vlc_player_destructor_Thread(void *data)
 {
     vlc_player_t *player = data;
 
+    vlc_thread_set_name("vlc-player-destructor");
+
     vlc_mutex_lock(&player->lock);
 
     /* Terminate this thread when the player is deleting (vlc_player_Delete()
diff --git a/src/posix/getaddrinfo.c b/src/posix/getaddrinfo.c
index c7f9bf07b57..eae812b7573 100644
--- a/src/posix/getaddrinfo.c
+++ b/src/posix/getaddrinfo.c
@@ -42,6 +42,8 @@ struct vlc_gai_req
 
 static void *vlc_gai_thread(void *data)
 {
+    vlc_thread_set_name("vlc-getaddrinfo");
+
     struct vlc_gai_req *req = data;
 
     req->error = EAI_SYSTEM;
diff --git a/src/posix/timer.c b/src/posix/timer.c
index d88df7d501b..7e63246a090 100644
--- a/src/posix/timer.c
+++ b/src/posix/timer.c
@@ -52,6 +52,8 @@ struct vlc_timer
 
 static void *vlc_timer_thread (void *data)
 {
+    vlc_thread_set_name("vlc-timer");
+
     struct vlc_timer *timer = data;
 
     vlc_mutex_lock (&timer->lock);
diff --git a/src/stream_output/sap.c b/src/stream_output/sap.c
index 0e699faeee2..b72db10863e 100644
--- a/src/stream_output/sap.c
+++ b/src/stream_output/sap.c
@@ -119,6 +119,8 @@ static void AddressDestroy (sap_address_t *addr)
  */
 static void *RunThread (void *self)
 {
+    vlc_thread_set_name("vlc-sap");
+
     sap_address_t *addr = self;
 
     vlc_mutex_lock(&sap_mutex);
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 57ee54e6e8b..e43d537781c 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1887,6 +1887,8 @@ static void *Thread(void *object)
     vout_thread_sys_t *vout = object;
     vout_thread_sys_t *sys = vout;
 
+    vlc_thread_set_name("vlc-vout");
+
     vlc_tick_t deadline = VLC_TICK_INVALID;
     bool wait = false;
 
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index f60c6f57973..c515930e349 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -1522,6 +1522,8 @@ static void * spu_PrerenderThread(void *priv)
     spu_private_t *sys = spu->p;
     vlc_fourcc_t chroma_list[SPU_CHROMALIST_COUNT+1];
 
+    vlc_thread_set_name("vlc-spu-prerender");
+
     chroma_list[SPU_CHROMALIST_COUNT] = 0;
 
     vlc_mutex_lock(&sys->prerender.lock);
diff --git a/src/win32/mta_holder.h b/src/win32/mta_holder.h
index dff4bfdfcac..c0f6ddab0eb 100644
--- a/src/win32/mta_holder.h
+++ b/src/win32/mta_holder.h
@@ -39,6 +39,8 @@ typedef struct vlc_mta_holder
 
 static inline void* MtaMainLoop( void* opaque )
 {
+    vlc_thread_set_name("vlc-mta");
+
     vlc_mta_holder* p_mta = (vlc_mta_holder*)opaque;
     CoInitializeEx( NULL, COINIT_MULTITHREADED );
 
-- 
2.26.2



More information about the vlc-devel mailing list