Set thread names to make it easier to identify threads during debugging

This commit is contained in:
chme
2016-03-05 13:19:55 +01:00
parent 9a5b67031e
commit 98d6db002f
7 changed files with 57 additions and 0 deletions

View File

@@ -30,6 +30,9 @@
#include <string.h>
#include <errno.h>
#include <pthread.h>
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# include <pthread_np.h>
#endif
#include <event2/event.h>
@@ -332,6 +335,12 @@ worker_init(void)
goto thread_fail;
}
#if defined(__linux__)
pthread_setname_np(tid_worker, "worker");
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
pthread_set_name_np(tid_worker, "worker");
#endif
return 0;
thread_fail: