diff options
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | common/threads.c (renamed from Alc/threads.c) | 31 |
2 files changed, 25 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 65cb0959..b15d9a1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -487,6 +487,8 @@ IF(NOT HAVE_STDINT_H) ENDIF() +SET(COMMON_OBJS common/threads.c +) SET(OPENAL_OBJS OpenAL32/alAuxEffectSlot.c OpenAL32/alBuffer.c OpenAL32/alEffect.c @@ -522,7 +524,6 @@ SET(ALC_OBJS Alc/ALc.c Alc/helpers.c Alc/hrtf.c Alc/panning.c - Alc/threads.c Alc/mixer.c Alc/mixer_c.c ) @@ -916,7 +917,7 @@ CONFIGURE_FILE( @ONLY) # Build a library -ADD_LIBRARY(${LIBNAME} ${LIBTYPE} ${OPENAL_OBJS} ${ALC_OBJS}) +ADD_LIBRARY(${LIBNAME} ${LIBTYPE} ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS}) SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_DEFINITIONS AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES) IF(WIN32 AND ALSOFT_NO_UID_DEFS) SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_DEFINITIONS AL_NO_UID_DEFS) diff --git a/Alc/threads.c b/common/threads.c index 06036685..ccbe209f 100644 --- a/Alc/threads.c +++ b/common/threads.c @@ -23,10 +23,10 @@ #include "threads.h" #include <stdlib.h> +#include <string.h> #include <errno.h> -#include "alMain.h" -#include "alThunk.h" +#include "uintmap.h" extern inline althrd_t althrd_current(void); @@ -42,6 +42,19 @@ extern inline void *altss_get(altss_t tss_id); extern inline int altss_set(altss_t tss_id, void *val); +#ifndef UNUSED +#if defined(__cplusplus) +#define UNUSED(x) +#elif defined(__GNUC__) +#define UNUSED(x) UNUSED_##x __attribute__((unused)) +#elif defined(__LCLINT__) +#define UNUSED(x) /*@unused@*/ x +#else +#define UNUSED(x) x +#endif +#endif + + #define THREAD_STACK_SIZE (1*1024*1024) /* 1MB */ #ifdef _WIN32 @@ -75,7 +88,8 @@ void althrd_setname(althrd_t thr, const char *name) } #undef MS_VC_EXCEPTION #else - TRACE("Can't set thread %04lx name to \"%s\"\n", thr, name); + (void)thr; + (void)name; #endif } @@ -323,17 +337,16 @@ void althrd_setname(althrd_t thr, const char *name) { #if defined(HAVE_PTHREAD_SETNAME_NP) #if defined(__GNUC__) - if(pthread_setname_np(thr, name) != 0) + pthread_setname_np(thr, name); #elif defined(__APPLE__) - if(!althrd_equal(thr, althrd_current()) - WARN("Can't set thread name \"%s\" on non-current thread"); - else if(pthread_setname_np(name) != 0) + if(althrd_equal(thr, althrd_current()) + pthread_setname_np(name); #endif - WARN("Failed to set thread name to \"%s\": %s\n", name, strerror(errno)); #elif defined(HAVE_PTHREAD_SET_NAME_NP) pthread_set_name_np(thr, name); #else - TRACE("Can't set thread name to \"%s\"\n", name); + (void)thr; + (void)name; #endif } |