This patch series enables building winpthreads with MSVC. The missing steps were about removing uses of GCC extensions, in favor of using functions already provided by windows.h. MinGW also provides these functions, so there is no need for redefinitions in winpthreads.
If there's interest, further work could switch to C11 atomics [1] instead of Windows Interlocked Variable Access [2] and WinAPI memory barriers that I've used to replace GCC old __sync extensions [3]. GCC introduced support for C11 atomics in 4.9, and MSVC recently introduced partial, but sufficient support for C11 atomics [4]. [1]: https://en.cppreference.com/w/c/atomic [2]: https://learn.microsoft.com/en-us/windows/win32/sync/interlocked-variable-access [3]: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html [4]: https://devblogs.microsoft.com/cppblog/c11-atomics-in-visual-studio-2022-version-17-5-preview-2/ Antonin Décimo (6): winpthreads: Check if requested stack size fits in an unsigned int winpthreads: Fix pthread_create_wrapper type winpthreads: Use YieldProcessor in pthread_spin_lock winpthreads: Use GetTickCount64 directly if available winpthreads: Replace GCC's __sync comparisons with WinAPI functions winpthreads: Don't use GCC __sync_synchronize .../winpthreads/include/pthread.h | 6 ++-- mingw-w64-libraries/winpthreads/src/misc.c | 29 +++++++++++++------ mingw-w64-libraries/winpthreads/src/misc.h | 12 -------- mingw-w64-libraries/winpthreads/src/mutex.c | 15 +++++----- .../winpthreads/src/spinlock.c | 12 ++------ mingw-w64-libraries/winpthreads/src/thread.c | 11 ++++--- 6 files changed, 40 insertions(+), 45 deletions(-) -- 2.43.0 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public