Jinoh Kang (@iamahuman) commented about dlls/win32u/win32u_private.h:
return !IsRectEmpty( dst );
}
+#if defined(__i386__) || defined(__x86_64__) +/* this prevents compilers from incorrectly reordering non-volatile reads (e.g., memcpy) from shared memory */ +#define __SHARED_READ_FENCE do { __asm__ __volatile__( "" ::: "memory" ); } while (0) +#else +#define __SHARED_READ_FENCE __atomic_thread_fence( __ATOMIC_ACQUIRE ) +#endif
+#define SHARED_READ_BEGIN( ptr, type ) \
```suggestion:-0+0 /* Begin a reader critical section of a seqlock. * * Due to how seqlock works, a read may (transiently) fail when it races with * the writer side. On such a failure, this macro attempts to iterate multiple * times until the read succeeds. * * This leads to the following anomalies: * * - Variables ever written by the section may not have initially set values. * - Conditionally written variables may have corrupted values on section exit. * * To prevent such anomalies from causing bugs, the body should be *idempotent*. * Specifically, you should keep in mind the following rules: * * 1. Avoid if()s, loops, and other kinds of conditional execution. If they're * needed for some reason, make sure that the conditions don't depend on * values from the shared memory at all. * * 2. A variable should only ever be *either* read *or* written in a critical * section, but *not both*. An exception to this rule is when the variable * has been already written before (in the same iteration). * * 3. In general, if you want to perform computation, I/O or a blocking * operation, do so outside (before or after) the critical section. * * Any (unavoidable) violation of the rules above should be reviewed carefully * so that it maintains the property of idempotence (the section body only reads * from the latest values in the face of multiple retries.) */ #define SHARED_READ_BEGIN( ptr, type ) \ ```