I think we could add a few checks to winpthreads' configure.ac and defined
Automake variables based on their results. We could either check host triplet
or do compilation tests checking for _M_{IX86,X64,ARM,ARM64,ARM64EC} macros.
Then, in tests/Makefile.am we should be able to
```
if ARM64
XFAIL_TESTS += ...
endif
```
to mark those tests as failing.
- Kirill Makurin
________________________________
From: Martin Storsjö <[email protected]>
Sent: Wednesday, October 1, 2025 7:58 PM
To: [email protected]
<[email protected]>
Subject: [Mingw-w64-public] [PATCH] winpthreads: Use InterlockedExchangePointer
in pthread_spin_unlock
This makes the write a proper atomic write, allowing other
threads, spinning on waiting to see it updated, to see the
write.
This avoids hangs in some cases, on aarch64.
Signed-off-by: Martin Storsjö <[email protected]>
---
With this in place, the winpthreads tests, after Kirill's patches,
no longer hangs.
Locally, I'm still seeing crashes in a couple pthread_cancel tests,
but those crashes don't seem to show up on the github actions
runners. I have a workaround for that, but I'd like to debug it
more and understand it deeper before sending that for review.
On the github actions runners, I'm instead seeing failures in
pthread_exit/exit1.c, which I've narrowed down to what seems to
be an issue in UCRT or in the host OS in that configuration - see
https://developercommunity.visualstudio.com/t/Crash-when-doing-ExitThread-on-main-thre/10975751
for more information about that. So we might need to conditionally
mark that one XFAIL somehow.
---
mingw-w64-libraries/winpthreads/src/spinlock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mingw-w64-libraries/winpthreads/src/spinlock.c
b/mingw-w64-libraries/winpthreads/src/spinlock.c
index eb21509d6..f9c5944dd 100644
--- a/mingw-w64-libraries/winpthreads/src/spinlock.c
+++ b/mingw-w64-libraries/winpthreads/src/spinlock.c
@@ -77,6 +77,6 @@ int
pthread_spin_unlock (pthread_spinlock_t *lock)
{
volatile spinlock_word_t *lk = (volatile spinlock_word_t *)lock;
- *lk = -1;
+ InterlockedExchangePointer((PVOID volatile *)lk, (void*)-1);
return 0;
}
--
2.43.0
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public