diff --git a/src/xpdev/threadwrap.c b/src/xpdev/threadwrap.c index 04a0a22f5b0207a36cbc2aad09b3daf78a1ed93e..9615166a9ed38c58ad7f7f8b5e738fda9e833635 100644 --- a/src/xpdev/threadwrap.c +++ b/src/xpdev/threadwrap.c @@ -217,7 +217,7 @@ int DLLCALL pthread_mutex_destroy(pthread_mutex_t* mutex) /* Protected (thread-safe) Integers (e.g. atomic/interlocked variables) */ /************************************************************************/ -#ifndef __unix__ +#if __STDC_NO_ATOMICS__ void DLLCALL protected_int32_init(protected_int32_t* prot, int32_t value) { prot->value = value; diff --git a/src/xpdev/threadwrap.h b/src/xpdev/threadwrap.h index a19fc227ccd2494e98064db262efc77b6c2a665f..592d0d839a18151b68dd4ceb775fa6a14c9eab58 100644 --- a/src/xpdev/threadwrap.h +++ b/src/xpdev/threadwrap.h @@ -40,7 +40,14 @@ #include "gen_defs.h" /* HANDLE */ #include "wrapdll.h" /* DLLEXPORT and DLLCALL */ -#ifdef __unix__ +#if !__STDC_NO_ATOMICS__ + #if defined __GNUC__ && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9)) + #define __STDC_NO_ATOMICS__ 1 + #elif defined __BORLANDC__ + #define __STDC_NO_ATOMICS__ 1 + #endif +#endif +#if !__STDC_NO_ATOMICS__ #include <stdbool.h> #ifdef __cplusplus #include <atomic> @@ -157,7 +164,7 @@ DLLEXPORT int DLLCALL pthread_once(pthread_once_t *oc, void (*init)(void)); /* working and being thread-safe on all platforms that support pthread */ /* mutexes. */ /************************************************************************/ -#ifdef __unix__ +#if !__STDC_NO_ATOMICS__ #ifdef __cplusplus typedef std::atomic<int32_t> protected_int32_t; typedef std::atomic<uint32_t> protected_uint32_t;