Torge Matthies (@tmatthies) commented about dlls/win32u/ntuser_private.h:
BOOL is_window( HWND hwnd ) DECLSPEC_HIDDEN;
+#if defined(__i386__) || defined(__x86_64__) +#define __SHARED_READ_SEQ( x ) (x) +#define __SHARED_READ_FENCE do {} while(0) +#else +#define __SHARED_READ_SEQ( x ) __atomic_load_n( &(x), __ATOMIC_RELAXED ) +#define __SHARED_READ_FENCE __atomic_thread_fence( __ATOMIC_ACQUIRE ) +#endif + +#define SHARED_READ_BEGIN( ptr, type ) \ + do { \ + const type *__shared = (ptr); \ + unsigned int __seq; \ + do { \ + while ((__seq = __SHARED_READ_SEQ( __shared->seq )) & 1) NtYieldExecution(); \ I think this `NtYieldExecution` should not be here, the lock is unlikely to be held for long enough to make a full `sched_yield` syscall worthwile.
while ((__seq = __SHARED_READ_SEQ( __shared->seq )) & 1) \
__asm__ __volatile__ ("":"+m"(__shared->seq)); \
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3103#note_42067