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

@@ -47,6 +47,7 @@
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# include <netinet/in.h>
# include <pthread_np.h>
#endif
#include "logger.h"
@@ -4909,6 +4910,12 @@ int mpd_init(void)
goto thread_fail;
}
#if defined(__linux__)
pthread_setname_np(tid_mpd, "mpd");
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
pthread_set_name_np(tid_mpd, "mpd");
#endif
idle_clients = NULL;
listener_add(mpd_listener_cb, LISTENER_PLAYER | LISTENER_PLAYLIST | LISTENER_VOLUME | LISTENER_SPEAKER | LISTENER_OPTIONS);