[Spice-devel] patch (RFC) - remove redundant calls to EngAcquireSemaphore/EngReleaseSemaphore in Windows' QXL display/res.c
Yaniv Kaul
ykaul at redhat.com
Sun Jul 31 08:30:48 PDT 2011
As correctly documented before the function, it is only called when the
semaphore is held, therefore no need to acquire nor release it:
diff --git a/display/res.c b/display/res.c
index 5d28184..df0ddba 100644
--- a/display/res.c
+++ b/display/res.c
@@ -1510,12 +1510,10 @@ static void ImageCacheAdd(PDev *pdev, CacheImage
*cache_image)
{
int key;
- EngAcquireSemaphore(pdev->Res->image_cache_sem);
key = IMAGE_HASH_VAL(cache_image->key);
cache_image->next = pdev->Res->image_cache[key];
cache_image->hits = 1;
pdev->Res->image_cache[key] = cache_image;
- EngReleaseSemaphore(pdev->Res->image_cache_sem);
}
(note: not even compile tested - haven't managed to compile on Windows yet).
[ykaul at ykaul qxl]$ grep ImageCacheAdd\(pdev -A 2 -B 8 display/res.c
EngAcquireSemaphore(pdev->Res->image_cache_sem);
cache_image = AllocCacheImage(pdev);
ImageCacheRemove(pdev, cache_image);
cache_image->key = key;
cache_image->image = NULL;
cache_image->format = format;
cache_image->width = surf->sizlBitmap.cx;
cache_image->height = surf->sizlBitmap.cy;
ImageCacheAdd(pdev, cache_image);
RingAdd(pdev, &pdev->Res->cache_image_lru, &cache_image->lru_link);
EngReleaseSemaphore(pdev->Res->image_cache_sem);
--
EngAcquireSemaphore(pdev->Res->image_cache_sem);
cache_image = AllocCacheImage(pdev);
ImageCacheRemove(pdev, cache_image);
cache_image->key = key;
cache_image->image = NULL;
cache_image->format = SPICE_BITMAP_FMT_RGBA;
cache_image->width = surf->sizlBitmap.cx;
cache_image->height = surf->sizlBitmap.cy;
ImageCacheAdd(pdev, cache_image);
RingAdd(pdev, &pdev->Res->cache_image_lru, &cache_image->lru_link);
EngReleaseSemaphore(pdev->Res->image_cache_sem);
Y.
More information about the Spice-devel
mailing list