set useful thread names for all spawned threads

This commit is contained in:
Stefan Seyfried
2017-02-12 15:17:32 +01:00
committed by svenhoefer
parent 6fdd920e42
commit 5188f721c4
14 changed files with 26 additions and 6 deletions

View File

@@ -15,6 +15,7 @@
#include "PacketQueue.hpp"
#include "helpers.hpp"
#include "dvbsubtitle.h"
#include <system/set_threadname.h>
#define Log2File printf
#define RECVBUFFER_STEPSIZE 1024
@@ -243,6 +244,7 @@ static void* reader_thread(void * /*arg*/)
int len;
uint16_t packlen;
uint8_t* buf;
set_threadname("dvbsub:reader");
dmx = new cDemux(0);
dmx->Open(DMX_PES_CHANNEL, NULL, 64*1024);
@@ -339,7 +341,7 @@ static void* dvbsub_thread(void* /*arg*/)
{
struct timespec restartWait;
struct timeval now;
set_threadname("dvbsub:main");
sub_debug.print(Debug::VERBOSE, "%s started\n", __FUNCTION__);
if (!dvbSubtitleConverter)
dvbSubtitleConverter = new cDvbSubtitleConverter;

View File

@@ -19,6 +19,7 @@
#include <dmx.h>
#include <video.h>
#include <sys/stat.h>
#include <system/set_threadname.h>
/* same as in rcinput.h... */
#define KEY_TTTV KEY_FN_1
@@ -1510,6 +1511,7 @@ static void cleanup_fb_pan()
static void* reader_thread(void * /*arg*/)
{
printf("TuxTxt subtitle thread started\n");
set_threadname("tuxtxt:reader");
reader_running = 1;
//ttx_paused = 0;
while(reader_running) {

View File

@@ -12,6 +12,7 @@
#endif
#include <zapit/include/dmx.h>
#include <system/set_threadname.h>
tuxtxt_cache_struct tuxtxt_cache;
static pthread_mutex_t tuxtxt_cache_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -587,6 +588,7 @@ void *tuxtxt_CacheThread(void * /*arg*/)
unsigned char pagedata[9][23*40];
tstPageinfo *pageinfo_thread;
set_threadname("tuxtxt:cache");
printf("TuxTxt running thread...(%04x)\n",tuxtxt_cache.vtxtpid);
tuxtxt_cache.receiving = 1;
nice(3);

View File

@@ -43,6 +43,7 @@
#include <driver/audioplay.h>
#include <driver/netfile.h>
#include <eitd/edvbstring.h> // UTF8
#include <system/set_threadname.h>
void CAudioPlayer::stop()
{
@@ -88,6 +89,7 @@ CAudioPlayer* CAudioPlayer::getInstance()
void* CAudioPlayer::PlayThread( void* /*dummy*/ )
{
int soundfd = -1;
set_threadname("audio:play");
g_RCInput->close_click();
/* Decode stdin to stdout. */
CBaseDec::RetCode Status =

View File

@@ -47,6 +47,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <system/set_threadname.h>
#include <daemonc/remotecontrol.h>
extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */
@@ -139,6 +140,7 @@ void CLCD::wake_up() {
#ifndef BOXMODEL_DM500
void* CLCD::TimeThread(void *)
{
set_threadname("lcd:time");
while(1)
{
sleep(1);

View File

@@ -108,6 +108,7 @@
#include <poll.h>
#include <sys/types.h>
#include <driver/audioplay.h>
#include <system/set_threadname.h>
/*
TODO:
- ICECAST support
@@ -1603,6 +1604,7 @@ void CacheFillThread(void *c)
if(scache->closed)
return;
set_threadname("netfile:cache");
dprintf(stderr, "CacheFillThread: thread started, using stream %p\n", scache->fd);
buf = (char*)malloc(CACHEBTRANS);

View File

@@ -35,6 +35,7 @@
#include <sys/timeb.h>
#include <time.h>
#include <unistd.h>
#include <system/set_threadname.h>
SHTDCNT::SHTDCNT()
@@ -55,6 +56,7 @@ SHTDCNT* SHTDCNT::getInstance()
void* SHTDCNT::TimeThread(void *)
{
set_threadname("n:shtdcnt");
while(1)
{
sleep(1);

View File

@@ -2067,6 +2067,7 @@ static void print_meminfo(void)
static void *houseKeepingThread(void *)
{
int count = 0, scount = 0, ecount = 0;
set_threadname("sd:housekeeping");
dprintf("housekeeping-thread started.\n");
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, 0);

View File

@@ -775,6 +775,7 @@ bool CCDraw::paintBlink(const int& interval, bool is_nano)
{
if (cc_draw_timer == NULL)
cc_draw_timer = new CComponentsTimer(interval, is_nano);
cc_draw_timer->setThreadName(__func__);
return paintBlink(cc_draw_timer);
}

View File

@@ -321,6 +321,7 @@ bool CComponentsFrmClock::startClock()
if (cl_timer == NULL){
cl_timer = new CComponentsTimer(0);
cl_timer->setThreadName("frmClock");
if (cl_timer->OnTimer.empty()){
dprintf(DEBUG_INFO,"\033[33m[CComponentsFrmClock]\t[%s] init slot...\033[0m\n", __func__);
cl_timer->OnTimer.connect(cl_sl_show);

View File

@@ -188,8 +188,10 @@ void CHintBox::enableTimeOutBar(bool enable)
timeout_pb = new CProgressBar();
timeout_pb->setDimensionsAll(ccw_body->getRealXPos(), ccw_body->getRealYPos(), ccw_body->getWidth(), TIMEOUT_BAR_HEIGHT);
timeout_pb->setValues(0, 100*timeout);
if (!timeout_pb_timer)
if (!timeout_pb_timer) {
timeout_pb_timer = new CComponentsTimer(1, true);
timeout_pb_timer->setThreadName("hb:tmoutbar");
}
timeout_pb_timer->OnTimer.connect(sigc::mem_fun0(this, &CHintBox::showTimeOutBar));
timeout_pb_timer->startTimer();
}
@@ -200,7 +202,6 @@ int CHintBox::exec()
neutrino_msg_t msg;
neutrino_msg_data_t data;
int res = messages_return::none;
if (timeout == NO_TIMEOUT || timeout == DEFAULT_TIMEOUT)
timeout = HINTBOX_DEFAULT_TIMEOUT;

View File

@@ -118,7 +118,7 @@ CWebserver::~CWebserver() {
#define MAX_TIMEOUTS_TO_CLOSE 10
#define MAX_TIMEOUTS_TO_TEST 100
bool CWebserver::run(void) {
set_threadname(__func__);
set_threadname("ywebsrv::run");
if (!listenSocket.listen(port, HTTPD_MAX_CONNECTIONS)) {
if (port != 80) {
fprintf(stderr, "[yhttpd] Socket cannot bind and listen on port %d Abort.\n", port);

View File

@@ -33,6 +33,7 @@
#include <sectionsdclient/sectionsdclient.h>
#include <connection/basicserver.h>
#include <timerdclient/timerdmsg.h>
#include <system/set_threadname.h>
#include "debug.h"
#include "timermanager.h"
@@ -480,7 +481,7 @@ bool timerd_parse_command(CBasicMessage::Header &rmsg, int connfd)
int timerd_main_thread(void *data)
{
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, 0);
set_threadname("n:timerd");
printf("timerd startup, tid %ld\n", syscall(__NR_gettid));
CBasicServer timerd_server;

View File

@@ -42,7 +42,7 @@
#include "debug.h"
#include "timermanager.h"
#include <system/set_threadname.h>
extern bool timeset;
time_t timer_minutes;
@@ -89,6 +89,7 @@ void* CTimerManager::timerThread(void *arg)
pthread_mutex_t dummy_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t dummy_cond = PTHREAD_COND_INITIALIZER;
struct timespec wait;
set_threadname("n:timermanager");
CTimerManager *timerManager = (CTimerManager*) arg;