[PATCH 1/7] gdiplus: Make GpBitmap->bitmapbits access thread safe

Dmitry Timoshkov dmitry at baikal.ru
Wed Feb 8 19:14:24 CST 2017


Piotr Caban <piotr at codeweavers.com> wrote:

> +static inline BOOL image_lock(GpImage *image, BOOL *unlock)
> +{
> +    LONG id = GetCurrentThreadId(), v;
> +    v = InterlockedCompareExchange(&image->busy, id, 0);
> +    *unlock = !v;
> +    return !v || v==id;
> +}

Variable 'v' could have a better naming, for instance 'busy' or 'owner_tid'.

> +static inline void image_unlock(GpImage *image, BOOL unlock)
> +{
> +    if (unlock) image->busy = 0;
> +}

Is that even possible to get image_unlock() called with unlock != TRUE?

-- 
Dmitry.



More information about the wine-devel mailing list