Add thread names for debugging

This commit is contained in:
emanuele-f 2019-02-21 11:51:57 +01:00
parent 07ff4dee54
commit 6f94f7b132
12 changed files with 32 additions and 14 deletions

View file

@ -26,13 +26,7 @@
/* **************************************************** */
static void* doRun(void* ptr) {
#ifdef __APPLE__
// Mac OS X: must be set from within the thread (can't specify thread ID)
char buf[32];
snprintf(buf, sizeof(buf), "ThreadPool worker");
if(pthread_setname_np(buf))
ntop->getTrace()->traceEvent(TRACE_WARNING, "Unable to set pthread name %s", buf);
#endif
Utils::setThreadName("TrPoolWorker");
((ThreadPool*)ptr)->run();
return(NULL);