diff --git a/src/utils/thread.c b/src/utils/thread.c index d874384f6..5bf668691 100644 --- a/src/utils/thread.c +++ b/src/utils/thread.c @@ -40,6 +40,9 @@ #endif #include +#ifndef _WIN32 +#include +#endif #ifdef HAVE_SETTHREADDESCRIPTION #include #endif @@ -65,7 +68,7 @@ static inline char *get_argv_program_name(void) { #endif void set_thread_name(const char *name) { -#ifdef HAVE_LINUX +#ifdef __linux__ // thread name can have at most 16 chars (including terminating null char) char *prog_name = get_argv_program_name(); char tmp[16]; @@ -74,14 +77,14 @@ void set_thread_name(const char *name) { free(prog_name); strncat(tmp, name, sizeof tmp - strlen(tmp) - 1); pthread_setname_np(pthread_self(), tmp); -#elif defined HAVE_MACOSX +#elif defined __APPLE__ char *prog_name = get_argv_program_name(); char *tmp = (char *) alloca(strlen(prog_name) + strlen(name) + 1); strcpy(tmp, prog_name); free(prog_name); strcat(tmp, name); pthread_setname_np(tmp); -#elif defined WIN32 +#elif defined _WIN32 // supported from Windows 10, not yet in headers #ifdef HAVE_SETTHREADDESCRIPTION const char *prog_name = get_argv_program_name(); diff --git a/src/utils/worker.cpp b/src/utils/worker.cpp index d26c4fc34..8c32fe08f 100644 --- a/src/utils/worker.cpp +++ b/src/utils/worker.cpp @@ -39,8 +39,8 @@ #include "utils/thread.h" #include "utils/worker.h" -#include #include +#include #include #include #include