On Wed, 24 Apr 2024, LIU Hao wrote:
在 2024-04-24 20:11, Martin Storsjö 写道:
Agreed, although it's less of a regression if we require windows headers
for pthread_cleanup_push only when built with MSVC, than making it required
for everybody, as the library wasn't usable at all with MSVC until
recently.
However, I looked at the output of _ReadWriteBarrier(), and in most cases,
it seems like this doesn't seem like something equivalent to
__sync_synchronize. In the mingw headers, it's just defined as __asm__
__volatile__ ("" ::: "memory"), i.e. something that stops the compiler from
reordering code across this point, but does nothing for synchronizing with
other threads. See e.g. https://godbolt.org/z/ccGdd7P44.
I.e., for now, I still think this patch in the shape I posted it, is the
best candidate for unbreaking this case.
This reminds me that `MemoryBarrier()` is a full barrier (`atomic_seq_cst`)
instead of a load-store barrier (`atomic_acq_rel`)., and the barriers are
there to prevent partial writes in case of asynchronous cancellation.
The patch looks correct to me. Please go ahead and apply. Thanks.
Applied now, thanks!
// Martin
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public