mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-30 13:42:58 -05:00
Set thread names to make it easier to identify threads during debugging
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user