forked from Mirrors/openclonk
Make StdSync.h compile with neither windows nor pthreads again
parent
d5c1cb8c51
commit
2d05c9501c
|
@ -56,15 +56,23 @@ public:
|
||||||
HANDLE GetEvent() { return hEvent; }
|
HANDLE GetEvent() { return hEvent; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#elif defined(HAVE_PTHREAD)
|
#else
|
||||||
|
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
// Value to specify infinite wait.
|
// Value to specify infinite wait.
|
||||||
#ifndef INFINITE
|
|
||||||
#define INFINITE (~0u)
|
#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
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_PTHREAD)
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
class CStdCSec
|
class CStdCSec
|
||||||
{
|
{
|
||||||
public:
|
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
|
#else
|
||||||
// Some stubs to silence the compiler
|
// Some stubs to silence the compiler
|
||||||
class CStdCSec
|
class CStdCSec
|
||||||
|
@ -175,6 +173,7 @@ public:
|
||||||
bool WaitFor(int) { return false; }
|
bool WaitFor(int) { return false; }
|
||||||
};
|
};
|
||||||
#endif // HAVE_PTHREAD
|
#endif // HAVE_PTHREAD
|
||||||
|
#endif // _WIN32
|
||||||
|
|
||||||
class CStdLock
|
class CStdLock
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue