From f0408809d6b2012aca0f1e8a344e087cb504a231 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 29 Jul 2019 09:29:35 -0700 Subject: Cleanup common sources' includes --- common/threads.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'common/threads.cpp') diff --git a/common/threads.cpp b/common/threads.cpp index 45f73243..fe34f5b0 100644 --- a/common/threads.cpp +++ b/common/threads.cpp @@ -22,12 +22,13 @@ #include "threads.h" -#include #include #ifdef _WIN32 +#include + void althrd_setname(const char *name) { #if defined(_MSC_VER) @@ -86,7 +87,7 @@ bool semaphore::try_wait() noexcept #else -#include +#if defined(HAVE_PTHREAD_SETNAME_NP) || defined(HAVE_PTHREAD_SET_NAME_NP) #include #ifdef HAVE_PTHREAD_NP_H #include @@ -94,20 +95,21 @@ bool semaphore::try_wait() noexcept void althrd_setname(const char *name) { -#if defined(HAVE_PTHREAD_SETNAME_NP) -#if defined(PTHREAD_SETNAME_NP_ONE_PARAM) +#if defined(HAVE_PTHREAD_SET_NAME_NP) + pthread_set_name_np(pthread_self(), name); +#elif defined(PTHREAD_SETNAME_NP_ONE_PARAM) pthread_setname_np(name); #elif defined(PTHREAD_SETNAME_NP_THREE_PARAMS) pthread_setname_np(pthread_self(), "%s", (void*)name); #else pthread_setname_np(pthread_self(), name); #endif -#elif defined(HAVE_PTHREAD_SET_NAME_NP) - pthread_set_name_np(pthread_self(), name); +} + #else - (void)name; + +void althrd_setname(const char*) { } #endif -} namespace al { @@ -134,6 +136,8 @@ bool semaphore::try_wait() noexcept #else /* !__APPLE__ */ +#include + semaphore::semaphore(unsigned int initial) { if(sem_init(&mSem, 0, initial) != 0) -- cgit v1.2.3