[misc] Centralize thread naming plus name websocket thread

This commit is contained in:
ejurgensen
2021-07-05 21:40:31 +02:00
parent eae09039d5
commit d2f4efa1bf
13 changed files with 33 additions and 83 deletions

View File

@@ -44,6 +44,9 @@
#ifdef HAVE_UUID
#include <uuid/uuid.h>
#endif
#ifdef HAVE_PTHREAD_NP_H
# include <pthread_np.h>
#endif
#include <netdb.h>
#include <arpa/inet.h>
@@ -1545,6 +1548,16 @@ mutex_init(pthread_mutex_t *mutex)
return err;
}
void
thread_setname(pthread_t thread, const char *name)
{
#if defined(HAVE_PTHREAD_SETNAME_NP)
pthread_setname_np(thread, name);
#elif defined(HAVE_PTHREAD_SET_NAME_NP)
pthread_set_name_np(thread, name);
#endif
}
#ifdef HAVE_UUID
void
uuid_make(char *str)