From d4c809c4aeef3bb878a3688742ce8474d420cd80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Wed, 11 May 2016 13:12:44 -0400 Subject: [PATCH] winpr: fix definitions of synchronization barrier and interlocked functions --- winpr/include/winpr/interlocked.h | 2 +- winpr/include/winpr/synch.h | 7 ++++++- winpr/libwinpr/synch/barrier.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/winpr/include/winpr/interlocked.h b/winpr/include/winpr/interlocked.h index 472579885..48bcca0a5 100644 --- a/winpr/include/winpr/interlocked.h +++ b/winpr/include/winpr/interlocked.h @@ -158,7 +158,7 @@ WINPR_API PVOID InterlockedCompareExchangePointer(PVOID volatile *Destination, P #endif /* _WIN32 */ -#if (!defined(_WIN32) || (defined(_WIN32) && !defined(_M_AMD64) && (_WIN32_WINNT < 0x0502))) +#if (!defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0502) && !defined(InterlockedCompareExchange64))) #define WINPR_INTERLOCKED_COMPARE_EXCHANGE64 1 #endif diff --git a/winpr/include/winpr/synch.h b/winpr/include/winpr/synch.h index eefca3c1c..d43a3ca98 100644 --- a/winpr/include/winpr/synch.h +++ b/winpr/include/winpr/synch.h @@ -329,7 +329,11 @@ WINPR_API VOID InitOnceInitialize(PINIT_ONCE InitOnce); /* Synchronization Barrier */ -#if (!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0602)) +#if (!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0602) && !defined(_SYNCHAPI_H_)) +#define WINPR_SYNCHRONIZATION_BARRIER 1 +#endif + +#ifdef WINPR_SYNCHRONIZATION_BARRIER typedef struct _RTL_BARRIER { @@ -353,6 +357,7 @@ WINPR_API BOOL WINAPI EnterSynchronizationBarrier(LPSYNCHRONIZATION_BARRIER lpBa WINPR_API BOOL WINAPI DeleteSynchronizationBarrier(LPSYNCHRONIZATION_BARRIER lpBarrier); #endif + /* Extended API */ WINPR_API VOID USleep(DWORD dwMicroseconds); diff --git a/winpr/libwinpr/synch/barrier.c b/winpr/libwinpr/synch/barrier.c index 225df0837..5aa91babb 100644 --- a/winpr/libwinpr/synch/barrier.c +++ b/winpr/libwinpr/synch/barrier.c @@ -27,7 +27,7 @@ #include -#if (!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0602)) +#ifdef WINPR_SYNCHRONIZATION_BARRIER #include #include