On Wed, 1 Oct 2025, LIU Hao wrote:
在 2025-10-1 20:26, Martin Storsjö 写道:
On GCC compatible compilers, use a store with release semantics;
this generates more efficient code than a full
InterlockedExchangePointer.
This avoids hangs in some cases, on aarch64.
Signed-off-by: Martin Storsjö <[email protected]>
---
mingw-w64-libraries/winpthreads/src/spinlock.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mingw-w64-libraries/winpthreads/src/spinlock.c
b/mingw-w64-libraries/winpthreads/src/spinlock.c
index eb21509d6..6e094d5ff 100644
--- a/mingw-w64-libraries/winpthreads/src/spinlock.c
+++ b/mingw-w64-libraries/winpthreads/src/spinlock.c
@@ -77,6 +77,10 @@ int
pthread_spin_unlock (pthread_spinlock_t *lock)
{
volatile spinlock_word_t *lk = (volatile spinlock_word_t *)lock;
- *lk = -1;
+#ifdef __GNUC__
I think this should be `#if defined __GNUC__ || defined __clang__` because
clang-cl doesn't define __GNUC__.
Sure, I can change it into that form as well.
// Martin
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public