winpr: fix definitions of synchronization barrier and interlocked functions
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Wed, 11 May 2016 17:12:44 +0000 (13:12 -0400)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Wed, 11 May 2016 17:12:44 +0000 (13:12 -0400)
winpr/include/winpr/interlocked.h
winpr/include/winpr/synch.h
winpr/libwinpr/synch/barrier.c

index 4725798..48bcca0 100644 (file)
@@ -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
 
index eefca3c..d43a3ca 100644 (file)
@@ -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);
index 225df08..5aa91ba 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <winpr/crt.h>
 
-#if (!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0602))
+#ifdef WINPR_SYNCHRONIZATION_BARRIER
 
 #include <winpr/library.h>
 #include <winpr/interlocked.h>