On Tue, Oct 4, 2022, 11:57 PM Zebediah Figura <zfigura@codeweavers.com> wrote:
On 10/3/22 07:46, Jinoh Kang wrote:
> From: Jinoh Kang <jinoh.kang.kr@gmail.com>
>
> This fixes data race in ARM/ARM64 platforms, and prevents potential
> memory access reordering by the compiler.
> ---
>   dlls/gdiplus/gdiplus_private.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
> index 7ae8cc564c9..c5a1e1adc59 100644
> --- a/dlls/gdiplus/gdiplus_private.h
> +++ b/dlls/gdiplus/gdiplus_private.h
> @@ -623,7 +623,7 @@ static inline BOOL image_lock(GpImage *image, BOOL *unlock)
>   
>   static inline void image_unlock(GpImage *image, BOOL unlock)
>   {
> -    if (unlock) image->busy = 0;
> +    if (unlock) WriteRelease(&image->busy, 0);
>   }
>   
>   static inline void set_rect(GpRectF *rect, REAL x, REAL y, REAL width, REAL height)

Why does this need release semantics,

This function can be inlined, and the write to `busy` can be reordered before any other operations.

and where is the corresponding
acquire?

In image_lock's `InterlockedCompareExchange(&image->busy, ...)`