From 2d05c9501c6d29ff4b042a5c0c70a25b122c9b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Brammer?= Date: Sun, 30 Dec 2012 00:58:29 +0100 Subject: [PATCH] Make StdSync.h compile with neither windows nor pthreads again --- src/platform/StdSync.h | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/platform/StdSync.h b/src/platform/StdSync.h index 2dda7860d..0c11e904d 100644 --- a/src/platform/StdSync.h +++ b/src/platform/StdSync.h @@ -56,15 +56,23 @@ public: HANDLE GetEvent() { return hEvent; } }; -#elif defined(HAVE_PTHREAD) - -#include - +#else // Value to specify infinite wait. -#ifndef INFINITE #define INFINITE (~0u) + +#if defined __GNUC__ && ((__GNUC__ >= 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ >= 5)) +inline long InterlockedIncrement(long * p) { return __sync_add_and_fetch(p, 1); } +inline long InterlockedDecrement(long * p) { return __sync_sub_and_fetch(p, 1); } +#else +// Defined in Standard.cpp +long InterlockedIncrement(long *); +long InterlockedDecrement(long *); +#define NEED_FALLBACK_ATOMIC_FUNCS 1 #endif +#if defined(HAVE_PTHREAD) +#include + class CStdCSec { public: @@ -144,16 +152,6 @@ public: } }; -#if defined __GNUC__ && ((__GNUC__ >= 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ >= 5)) -inline long InterlockedIncrement(long * p) { return __sync_add_and_fetch(p, 1); } -inline long InterlockedDecrement(long * p) { return __sync_sub_and_fetch(p, 1); } -#else -// Defined in Standard.cpp -long InterlockedIncrement(long *); -long InterlockedDecrement(long *); -#define NEED_FALLBACK_ATOMIC_FUNCS 1 -#endif - #else // Some stubs to silence the compiler class CStdCSec @@ -175,6 +173,7 @@ public: bool WaitFor(int) { return false; } }; #endif // HAVE_PTHREAD +#endif // _WIN32 class CStdLock {