The __sync_synchronize built-in function [1] is deprecated, and not
defined with MSVC. Prefer MemoryBarrier [2] and _ReadWriteBarrier [3].

[1]: 
https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html#index-_005f_005fsync_005fsynchronize
[2]: 
https://learn.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-memorybarrier
[3]: 
https://learn.microsoft.com/en-us/cpp/intrinsics/readwritebarrier\?view\=msvc-170

Signed-off-by: Antonin Décimo <anto...@tarides.com>
---
 mingw-w64-libraries/winpthreads/include/pthread.h | 4 ++--
 mingw-w64-libraries/winpthreads/src/misc.h        | 4 ----
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/mingw-w64-libraries/winpthreads/include/pthread.h 
b/mingw-w64-libraries/winpthreads/include/pthread.h
index 4ce815c64..df507d6a0 100644
--- a/mingw-w64-libraries/winpthreads/include/pthread.h
+++ b/mingw-w64-libraries/winpthreads/include/pthread.h
@@ -212,9 +212,9 @@ struct _pthread_cleanup
     do {                                                                \
         const _pthread_cleanup _pthread_cup =                           \
             { (F), (A), *pthread_getclean() };                          \
-        __sync_synchronize();                                           \
+        MemoryBarrier();                                                \
         *pthread_getclean() = (_pthread_cleanup *) &_pthread_cup;       \
-        __sync_synchronize();                                           \
+        MemoryBarrier();                                                \
         do {                                                            \
             do {} while (0)
 
diff --git a/mingw-w64-libraries/winpthreads/src/misc.h 
b/mingw-w64-libraries/winpthreads/src/misc.h
index ce278c976..eb0f7f2b6 100644
--- a/mingw-w64-libraries/winpthreads/src/misc.h
+++ b/mingw-w64-libraries/winpthreads/src/misc.h
@@ -101,10 +101,6 @@ static WINPTHREADS_INLINE unsigned long 
dwMilliSecs(unsigned long long ms)
   return (unsigned long) ms;
 }
 
-#ifndef _ReadWriteBarrier
-#define _ReadWriteBarrier   __sync_synchronize
-#endif
-
 unsigned long long _pthread_time_in_ms(void);
 unsigned long long _pthread_time_in_ms_from_timespec(const struct timespec 
*ts);
 unsigned long long _pthread_rel_time_in_ms(const struct timespec *ts);
-- 
2.43.0



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to