void
avahi_init(void)
{
- tvhthread_create(&avahi_tid, NULL, avahi_thread, NULL);
+ tvhthread_create(&avahi_tid, NULL, avahi_thread, NULL, "avahi");
}
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
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);
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
}
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);
return;
}
- tvhthread_create(&dvr_inotify_tid, NULL, _dvr_inotify_thread, NULL);
+ tvhthread_create(&dvr_inotify_tid, NULL, _dvr_inotify_thread, NULL, "dvr-inotify");
}
/**
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;
}
/* 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");
}
/*
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;
}
{
/* 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");
}
/*
pthread_mutex_unlock(&global_lock);
tvhthread_create(&htsp.htsp_writer_thread, NULL,
- htsp_write_scheduler, &htsp);
+ htsp_write_scheduler, &htsp, "htsp-write");
/**
* Reader loop
/* 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
/* 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
/* 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 )
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);
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
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;
}
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 */
/* 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);
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);
notify_queue = NULL;
pthread_mutex_init(¬ify_mutex, NULL);
pthread_cond_init(¬ify_cond, NULL);
- tvhthread_create(¬ify_tid, NULL, notify_thread, NULL);
+ tvhthread_create(¬ify_tid, NULL, notify_thread, NULL, "notify");
}
void notify_done( void )
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);
}
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");
}
/*
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
{
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
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");
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
/* 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++;
pthread_cond_init(×hift_reaper_cond, NULL);
TAILQ_INIT(×hift_reaper_list);
tvhthread_create(×hift_reaper_thread, NULL,
- timeshift_reaper_callback, NULL);
+ timeshift_reaper_callback, NULL, "tshift-reap");
}
/*
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);
void
tvhlog_start ( void )
{
- tvhthread_create(&tvhlog_tid, NULL, tvhlog_thread, NULL);
+ tvhthread_create(&tvhlog_tid, NULL, tvhlog_thread, NULL, "log");
}
void
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
}
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;