Piotr Caban piotr@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?
Hi Dmitry,
On 09/02/17 02:14, Dmitry Timoshkov wrote:
+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?
Currently not, but in theory we should do something like this on all functions working on GpImage (I haven't tested all of them). For example it should be done in GdipGetImageWidth. This function is used internally so it will be useful to handle it. It also makes it harder to write incorrect code.
Thanks, Piotr