]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
tvhthread_create: use more nice names
authorJaroslav Kysela <perex@perex.cz>
Fri, 16 Oct 2015 19:17:47 +0000 (21:17 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 16 Oct 2015 19:17:47 +0000 (21:17 +0200)
30 files changed:
src/avahi.c
src/dbus.c
src/descrambler/capmt.c
src/descrambler/cwc.c
src/dvr/dvr_inotify.c
src/dvr/dvr_rec.c
src/epggrab.c
src/epggrab/module.c
src/fsmonitor.c
src/htsp_server.c
src/httpc.c
src/imagecache.c
src/input/mpegts/iptv/iptv.c
src/input/mpegts/linuxdvb/linuxdvb_frontend.c
src/input/mpegts/mpegts_input.c
src/input/mpegts/satip/satip_frontend.c
src/input/mpegts/tsfile/tsfile_input.c
src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c
src/main.c
src/notify.c
src/satip/rtp.c
src/service.c
src/service_mapper.c
src/tcp.c
src/timeshift.c
src/timeshift/timeshift_filemgr.c
src/tvheadend.h
src/tvhlog.c
src/upnp.c
src/wrappers.c

index 2dd1092f4ccc9ad366119cc751898820f11b3d18..923986e23a449e64eb5eca515b254c0f09e5e835 100644 (file)
@@ -303,7 +303,7 @@ pthread_t avahi_tid;
 void
 avahi_init(void)
 {
-  tvhthread_create(&avahi_tid, NULL, avahi_thread, NULL);
+  tvhthread_create(&avahi_tid, NULL, avahi_thread, NULL, "avahi");
 }
 
 void
index 4071faec2a7fbcebcb98e0a1b1f88fce001028e7..b0cdfc220184b22e4316a39c5e0d4fafa671c4ab 100644 (file)
@@ -458,7 +458,7 @@ void
 dbus_server_start(void)
 {
   if (dbus_pipe.wr > 0)
-    tvhthread_create(&dbus_tid, NULL, dbus_server_thread, NULL);
+    tvhthread_create(&dbus_tid, NULL, dbus_server_thread, NULL, "dbus");
 }
 
 void
index cf3865e4824594875cf5f5c9aa0722b0fe32e3f5..0286f593884b67821acf32b58aeae78c34db385f 100644 (file)
@@ -2168,7 +2168,7 @@ capmt_conf_changed(caclient_t *cac)
     if (!capmt->capmt_running) {
       capmt->capmt_running = 1;
       capmt->capmt_reconfigure = 0;
-      tvhthread_create(&capmt->capmt_tid, NULL, capmt_thread, capmt);
+      tvhthread_create(&capmt->capmt_tid, NULL, capmt_thread, capmt, "capmt");
       return;
     }
     pthread_mutex_lock(&capmt->capmt_mutex);
index f722b435c5fdb33c8f1127e4b0ef43545e9151de..54c3e07f72880a85ac1eae969e3581f8b0729744 100644 (file)
@@ -1082,7 +1082,7 @@ cwc_session(cwc_t *cwc)
   pthread_cond_init(&cwc->cwc_writer_cond, NULL);
   pthread_mutex_init(&cwc->cwc_writer_mutex, NULL);
   TAILQ_INIT(&cwc->cwc_writeq);
-  tvhthread_create(&writer_thread_id, NULL, cwc_writer_thread, cwc);
+  tvhthread_create(&writer_thread_id, NULL, cwc_writer_thread, cwc, "cwc-writer");
 
   /**
    * Mainloop
@@ -1654,7 +1654,7 @@ cwc_conf_changed(caclient_t *cac)
     }
     if (!cwc->cwc_running) {
       cwc->cwc_running = 1;
-      tvhthread_create(&cwc->cwc_tid, NULL, cwc_thread, cwc);
+      tvhthread_create(&cwc->cwc_tid, NULL, cwc_thread, cwc, "cwc");
       return;
     }
     pthread_mutex_lock(&cwc->cwc_mutex);
index e30e5eace6d10228805aeecc3b80b9c2cb239417..472d292b5f32cb1c1661ecbecea207c1eda3a57d 100644 (file)
@@ -70,7 +70,7 @@ void dvr_inotify_init ( void )
     return;
   }
 
-  tvhthread_create(&dvr_inotify_tid, NULL, _dvr_inotify_thread, NULL);
+  tvhthread_create(&dvr_inotify_tid, NULL, _dvr_inotify_thread, NULL, "dvr-inotify");
 }
 
 /**
index 35c71611edd3895e9ca3b1bf9fdb16aa7345727b..2fbfe384d0eeacc993047bb78c30bcd06c1a86d4 100644 (file)
@@ -149,7 +149,7 @@ dvr_rec_subscribe(dvr_entry_t *de)
   de->de_chain = prch;
 
   de->de_thread_shutdown = 0;
-  tvhthread_create(&de->de_thread, NULL, dvr_thread, de);
+  tvhthread_create(&de->de_thread, NULL, dvr_thread, de, "dvr");
   return 0;
 }
 
index 2db756c68979e9b686de712c6722fd4e432874c3..db13e7320473f82b7cb9461c32500fcc047abae8 100644 (file)
@@ -370,7 +370,7 @@ void epggrab_init ( void )
 
   /* Start internal grab thread */
   epggrab_running = 1;
-  tvhthread_create(&epggrab_tid, NULL, _epggrab_internal_thread, NULL);
+  tvhthread_create(&epggrab_tid, NULL, _epggrab_internal_thread, NULL, "epggrabi");
 }
 
 /*
index 1034beffe4f5a05f951ff9ddd998dd288fc6e3b8..540c3259be7b1efa5c877a659fdb4862c03d099f 100644 (file)
@@ -583,7 +583,7 @@ epggrab_module_activate_socket ( void *m, int a )
     tvhlog(LOG_DEBUG, mod->id, "starting socket thread");
     pthread_attr_init(&tattr);
     mod->active = 1;
-    tvhthread_create(&mod->tid, &tattr, _epggrab_socket_thread, mod);
+    tvhthread_create(&mod->tid, &tattr, _epggrab_socket_thread, mod, "epggrabso");
   }
   return 1;
 }
index a311fcb90e93acfd0dc19064e7710edf6602543d..595f6c3af3cdcb4827df53887c5c05516af651aa 100644 (file)
@@ -106,7 +106,7 @@ fsmonitor_init ( void )
 {
   /* Intialise inotify */
   fsmonitor_fd = inotify_init1(IN_CLOEXEC);
-  tvhthread_create0(&fsmonitor_tid, NULL, fsmonitor_thread, NULL, "fsmonitor");
+  tvhthread_create(&fsmonitor_tid, NULL, fsmonitor_thread, NULL, "fsmonitor");
 }
 
 /*
index 92d83890eec73386f2a61823a64e6a74608fde2b..99cbd9cc9a33e69f2cac697af0088d810e7352b1 100644 (file)
@@ -2935,7 +2935,7 @@ htsp_serve(int fd, void **opaque, struct sockaddr_storage *source,
   pthread_mutex_unlock(&global_lock);
 
   tvhthread_create(&htsp.htsp_writer_thread, NULL,
-                   htsp_write_scheduler, &htsp);
+                   htsp_write_scheduler, &htsp, "htsp-write");
 
   /**
    * Reader loop
index d92971aaf7a1526f8a8766daa5a26ee85f340415..56d2b8dbd8659eec5940757956e63ff94e36e949 100644 (file)
@@ -1501,7 +1501,7 @@ http_client_init ( const char *user_agent )
 
   /* Setup thread */
   http_running = 1;
-  tvhthread_create(&http_client_tid, NULL, http_client_thread, NULL);
+  tvhthread_create(&http_client_tid, NULL, http_client_thread, NULL, "httpc");
 #if HTTPCLIENT_TESTSUITE
   http_client_testsuite_run();
 #endif
index c46e7d50cf9220013e060a00d647042403411fd5..67337836139b5724a7b3ddba5ca78452c6dda235 100644 (file)
@@ -445,7 +445,7 @@ imagecache_init ( void )
 
   /* Start threads */
 #if ENABLE_IMAGECACHE
-  tvhthread_create(&imagecache_tid, NULL, imagecache_thread, NULL);
+  tvhthread_create(&imagecache_tid, NULL, imagecache_thread, NULL, "imagecache");
 
   /* Re-try timer */
   // TODO: this could be more efficient by being targetted, however
index 1d608dda7fc70d2b18cfe660afcf17d1e6faa869..5c9521a021176b67d12672d47f1e1ab9b86a72cf 100644 (file)
@@ -896,7 +896,7 @@ void iptv_init ( void )
   /* Setup TS thread */
   iptv_poll = tvhpoll_create(10);
   pthread_mutex_init(&iptv_lock, NULL);
-  tvhthread_create(&iptv_thread, NULL, iptv_input_thread, NULL);
+  tvhthread_create(&iptv_thread, NULL, iptv_input_thread, NULL, "iptv");
 }
 
 void iptv_done ( void )
index 10c8deedb559fb78015ffeca210680d529ea807d..3f66959d7cb1a10107947f623f4b44a810e77004 100644 (file)
@@ -675,7 +675,7 @@ linuxdvb_frontend_monitor ( void *aux )
       tvh_pipe(O_NONBLOCK, &lfe->lfe_dvr_pipe);
       pthread_mutex_lock(&lfe->lfe_dvr_lock);
       tvhthread_create(&lfe->lfe_dvr_thread, NULL,
-                       linuxdvb_frontend_input_thread, lfe);
+                       linuxdvb_frontend_input_thread, lfe, "lnxdvb-front");
       pthread_cond_wait(&lfe->lfe_dvr_cond, &lfe->lfe_dvr_lock);
       pthread_mutex_unlock(&lfe->lfe_dvr_lock);
 
index c398ada89b3548293fbbb5194db35b5e23d60b3e..cb797328782aa21ab41bc68face41413c3c2f640 100644 (file)
@@ -1548,9 +1548,9 @@ mpegts_input_thread_start ( mpegts_input_t *mi )
   mi->mi_running = 1;
   
   tvhthread_create(&mi->mi_table_tid, NULL,
-                   mpegts_input_table_thread, mi);
+                   mpegts_input_table_thread, mi, "mi-table");
   tvhthread_create(&mi->mi_input_tid, NULL,
-                   mpegts_input_thread, mi);
+                   mpegts_input_thread, mi, "mi-main");
 }
 
 static void
index efea4799b994cb1ce31695c8a88451bcf2e2421d..a7454606c1f37d8865054a5e0f5f27a56fb0c3b9 100644 (file)
@@ -1794,7 +1794,7 @@ satip_frontend_create
 
   tvh_pipe(O_NONBLOCK, &lfe->sf_dvr_pipe);
   tvhthread_create(&lfe->sf_dvr_thread, NULL,
-                   satip_frontend_input_thread, lfe);
+                   satip_frontend_input_thread, lfe, "satip-front");
 
   return lfe;
 }
index 29dc6cd7202c3f4b1b53c8e17699647d7b5f0269..5e8d44edb56e27d5653332eb0a3131e8f6d6f34e 100644 (file)
@@ -228,7 +228,7 @@ tsfile_input_start_mux ( mpegts_input_t *mi, mpegts_mux_instance_t *t )
       return SM_CODE_TUNING_FAILED;
     }
     tvhtrace("tsfile", "adapter %d starting thread", mi->mi_instance);
-    tvhthread_create(&ti->ti_thread_id, NULL, tsfile_input_thread, mi);
+    tvhthread_create(&ti->ti_thread_id, NULL, tsfile_input_thread, mi, "tsfile");
   }
 
   /* Current */
index a845a76459a67fbd379b1a882df499388cefc0a5..6ebab7efba783496b4a7b41f23a90f7e392fd848 100644 (file)
@@ -254,7 +254,7 @@ tvhdhomerun_frontend_monitor_cb( void *aux )
       /* start input thread */
       tvh_pipe(O_NONBLOCK, &hfe->hf_input_thread_pipe);
       pthread_mutex_lock(&hfe->hf_input_thread_mutex);
-      tvhthread_create(&hfe->hf_input_thread, NULL, tvhdhomerun_frontend_input_thread, hfe);
+      tvhthread_create(&hfe->hf_input_thread, NULL, tvhdhomerun_frontend_input_thread, hfe, "hdhm-front");
       pthread_cond_wait(&hfe->hf_input_thread_cond, &hfe->hf_input_thread_mutex);
       pthread_mutex_unlock(&hfe->hf_input_thread_mutex);
 
index d5c410df48a0b8f49ec90449088746c6e9a9a6a7..81c7f7bc7627d1cd02423777024af664905215ed 100644 (file)
@@ -1001,7 +1001,7 @@ main(int argc, char **argv)
 
   epg_in_load = 1;
 
-  tvhthread_create(&tasklet_tid, NULL, tasklet_thread, NULL);
+  tvhthread_create(&tasklet_tid, NULL, tasklet_thread, NULL, "tasklet");
 
   dbus_server_init(opt_dbus, opt_dbus_session);
 
index 77fd2b1ce6282620b28c32fa94b72d16f324f5f7..b7b8b1a87a08b9a4177a6a5e80ab89068ff45a89 100644 (file)
@@ -127,7 +127,7 @@ void notify_init( void )
   notify_queue = NULL;
   pthread_mutex_init(&notify_mutex, NULL);
   pthread_cond_init(&notify_cond, NULL);
-  tvhthread_create(&notify_tid, NULL, notify_thread, NULL);
+  tvhthread_create(&notify_tid, NULL, notify_thread, NULL, "notify");
 }
 
 void notify_done( void )
index b9e770efaca5951a0b022f5dd318aa48d9d945a0..5bebac35d62c91717a5e3bab8130d284f0a87731 100644 (file)
@@ -389,7 +389,7 @@ void satip_rtp_queue(void *id, th_subscription_t *subs,
 
   pthread_mutex_lock(&satip_rtp_lock);
   TAILQ_INSERT_TAIL(&satip_rtp_sessions, rtp, link);
-  tvhthread_create(&rtp->tid, NULL, satip_rtp_thread, rtp);
+  tvhthread_create(&rtp->tid, NULL, satip_rtp_thread, rtp, "satip-rtp");
   pthread_mutex_unlock(&satip_rtp_lock);
 }
 
@@ -785,7 +785,7 @@ void satip_rtp_init(void)
   pthread_mutex_init(&satip_rtp_lock, NULL);
 
   satip_rtcp_run = 1;
-  tvhthread_create(&satip_rtcp_tid, NULL, satip_rtcp_thread, NULL);
+  tvhthread_create(&satip_rtcp_tid, NULL, satip_rtcp_thread, NULL, "satip-rtcp");
 }
 
 /*
index b1e13ce84868bbb5cf7ece18181b889b775ac184..2acf4e4782668fc82a819cfc7afca577d8fe5b50 100644 (file)
@@ -1385,7 +1385,7 @@ service_init(void)
   TAILQ_INIT(&service_raw_all);
   pthread_mutex_init(&pending_save_mutex, NULL);
   pthread_cond_init(&pending_save_cond, NULL);
-  tvhthread_create(&service_saver_tid, NULL, service_saver, NULL);
+  tvhthread_create(&service_saver_tid, NULL, service_saver, NULL, "service");
 }
 
 void
index 5a22221ee56f7335793c0718c6b3407d3fb99338..3a35cd10940b70d8017d2d0ee931a04e78b9bf58 100644 (file)
@@ -51,7 +51,7 @@ service_mapper_init ( void )
 {
   TAILQ_INIT(&service_mapper_queue);
   pthread_cond_init(&service_mapper_cond, NULL);
-  tvhthread_create(&service_mapper_tid, NULL, service_mapper_thread, NULL);
+  tvhthread_create(&service_mapper_tid, NULL, service_mapper_thread, NULL, "svcmap");
 }
 
 void
index 7cba1c55053f6af21843c9a221bfe3535cec51bf..83666886ff1bada4792b5db7795b1b5bb441514a 100644 (file)
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -706,7 +706,7 @@ next:
       pthread_mutex_lock(&global_lock);
       LIST_INSERT_HEAD(&tcp_server_active, tsl, alink);
       pthread_mutex_unlock(&global_lock);
-      tvhthread_create(&tsl->tid, NULL, tcp_server_start, tsl);
+      tvhthread_create(&tsl->tid, NULL, tcp_server_start, tsl, "tcp-start");
     }
   }
   tvhtrace("tcp", "server thread finished");
@@ -1050,7 +1050,7 @@ tcp_server_init(void)
   tvhpoll_add(tcp_server_poll, &ev, 1);
 
   tcp_server_running = 1;
-  tvhthread_create(&tcp_server_tid, NULL, tcp_server_loop, NULL);
+  tvhthread_create(&tcp_server_tid, NULL, tcp_server_loop, NULL, "tcp-loop");
 }
 
 void
index 3f60d7e4690e07d663a811b7a3689b162b4be5f0..452e69ea8a7da040be165efbcf058ae34b1bbc0b 100644 (file)
@@ -407,8 +407,8 @@ streaming_target_t *timeshift_create
   /* Initialise input */
   streaming_queue_init(&ts->wr_queue, 0, 0);
   streaming_target_init(&ts->input, timeshift_input, ts, 0);
-  tvhthread_create(&ts->wr_thread, NULL, timeshift_writer, ts);
-  tvhthread_create(&ts->rd_thread, NULL, timeshift_reader, ts);
+  tvhthread_create(&ts->wr_thread, NULL, timeshift_writer, ts, "tshift-wr");
+  tvhthread_create(&ts->rd_thread, NULL, timeshift_reader, ts, "tshift-rd");
 
   /* Update index */
   timeshift_index++;
index 0da28b120a158a0312a0f28fb94a88a8e2d6a4d7..48fc358db02847446f06fd2a653861088cb13402 100644 (file)
@@ -410,7 +410,7 @@ void timeshift_filemgr_init ( void )
   pthread_cond_init(&timeshift_reaper_cond, NULL);
   TAILQ_INIT(&timeshift_reaper_list);
   tvhthread_create(&timeshift_reaper_thread, NULL,
-                   timeshift_reaper_callback, NULL);
+                   timeshift_reaper_callback, NULL, "tshift-reap");
 }
 
 /*
index aa6decac820b5728822439274912c3ef6999ce13..c1bbf26b01346e4686ac303b3ea941fe93ff9bff 100644 (file)
@@ -638,13 +638,11 @@ static inline void mystrset(char **p, const char *s)
 
 void doexit(int x);
 
-int tvhthread_create0
+int tvhthread_create
   (pthread_t *thread, const pthread_attr_t *attr,
    void *(*start_routine) (void *), void *arg,
    const char *name);
 
-#define tvhthread_create(a, b, c, d)  tvhthread_create0(a, b, c, d, #c)
-
 int tvh_open(const char *pathname, int flags, mode_t mode);
 
 int tvh_socket(int domain, int type, int protocol);
index f2bbfc629c0c1be5002bb0d2eeb83f77db622a14..5af7bce2db4cb140bac4ef50f86781c0b8ac63d9 100644 (file)
@@ -420,7 +420,7 @@ tvhlog_init ( int level, int options, const char *path )
 void
 tvhlog_start ( void )
 {
-  tvhthread_create(&tvhlog_tid, NULL, tvhlog_thread, NULL);
+  tvhthread_create(&tvhlog_tid, NULL, tvhlog_thread, NULL, "log");
 }
 
 void
index 137322c7d3bb88bdd9743f8ab020f51c8ff77b74..bf0c489138b1e8f9713262830fc7091d42a5f49b 100644 (file)
@@ -245,7 +245,7 @@ upnp_server_init(const char *bindaddr)
   TAILQ_INIT(&upnp_data_write);
   TAILQ_INIT(&upnp_services);
   upnp_running = 1;
-  tvhthread_create(&upnp_tid, NULL, upnp_thread, (char *)bindaddr);
+  tvhthread_create(&upnp_tid, NULL, upnp_thread, (char *)bindaddr, "upnp");
 }
 
 void
index f464e7c431982c601867cf53eb0d76bd257a3269..7d1ab9c89bd37ecae8cd517587a083d0fa79ba12 100644 (file)
@@ -181,13 +181,14 @@ thread_wrapper ( void *p )
 }
 
 int
-tvhthread_create0
+tvhthread_create
   (pthread_t *thread, const pthread_attr_t *attr,
    void *(*start_routine) (void *), void *arg, const char *name)
 {
   int r;
   struct thread_state *ts = calloc(1, sizeof(struct thread_state));
-  strncpy(ts->name, name, sizeof(ts->name));
+  strncpy(ts->name, "tvh:", 4);
+  strncpy(ts->name+4, name, sizeof(ts->name));
   ts->name[sizeof(ts->name)-1] = '\0';
   ts->run  = start_routine;
   ts->arg  = arg;