Jacek Caban : gdi32: Use pthread mutex in dib driver.
Alexandre Julliard
julliard at winehq.org
Mon Oct 4 15:42:19 CDT 2021
Module: wine
Branch: master
Commit: fb6421f229fb94f0a7f1e6c2e922a5611223e50c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=fb6421f229fb94f0a7f1e6c2e922a5611223e50c
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Oct 4 15:03:16 2021 +0100
gdi32: Use pthread mutex in dib driver.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/dibdrv/graphics.c | 16 +++++-----------
dlls/gdi32/win32u_private.h | 3 ---
2 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c
index 875ae308546..410f29e8f19 100644
--- a/dlls/gdi32/dibdrv/graphics.c
+++ b/dlls/gdi32/dibdrv/graphics.c
@@ -23,6 +23,7 @@
#endif
#include <assert.h>
+#include <pthread.h>
#include "ntgdi_private.h"
#include "dibdrv.h"
@@ -59,14 +60,7 @@ struct cached_font
static struct list font_cache = LIST_INIT( font_cache );
-static CRITICAL_SECTION font_cache_cs;
-static CRITICAL_SECTION_DEBUG critsect_debug =
-{
- 0, 0, &font_cache_cs,
- { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
- 0, 0, { (DWORD_PTR)(__FILE__ ": font_cache_cs") }
-};
-static CRITICAL_SECTION font_cache_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
+static pthread_mutex_t font_cache_lock = PTHREAD_MUTEX_INITIALIZER;
static BOOL brush_rect( dibdrv_physdev *pdev, dib_brush *brush, const RECT *rect, HRGN clip )
@@ -575,7 +569,7 @@ static struct cached_font *add_cached_font( DC *dc, HFONT hfont, UINT aa_flags )
font.aa_flags = aa_flags;
font.hash = font_cache_hash( &font );
- EnterCriticalSection( &font_cache_cs );
+ pthread_mutex_lock( &font_cache_lock );
LIST_FOR_EACH_ENTRY( ptr, &font_cache, struct cached_font, entry )
{
if (!font_cache_cmp( &font, ptr ))
@@ -608,7 +602,7 @@ static struct cached_font *add_cached_font( DC *dc, HFONT hfont, UINT aa_flags )
}
else if (!(ptr = malloc( sizeof(*ptr) )))
{
- LeaveCriticalSection( &font_cache_cs );
+ pthread_mutex_unlock( &font_cache_lock );
return NULL;
}
@@ -617,7 +611,7 @@ static struct cached_font *add_cached_font( DC *dc, HFONT hfont, UINT aa_flags )
memset( ptr->glyphs, 0, sizeof(ptr->glyphs) );
done:
list_add_head( &font_cache, &ptr->entry );
- LeaveCriticalSection( &font_cache_cs );
+ pthread_mutex_unlock( &font_cache_lock );
TRACE( "%d %s -> %p\n", ptr->lf.lfHeight, debugstr_w(ptr->lf.lfFaceName), ptr );
return ptr;
}
diff --git a/dlls/gdi32/win32u_private.h b/dlls/gdi32/win32u_private.h
index 836d8014f01..d986bf339c3 100644
--- a/dlls/gdi32/win32u_private.h
+++ b/dlls/gdi32/win32u_private.h
@@ -395,7 +395,4 @@ static inline LONG win32u_wcstol( LPCWSTR s, LPWSTR *end, INT base )
#define wcsrchr(s,c) win32u_wcsrchr(s,c)
#define wcstol(s,e,b) win32u_wcstol(s,e,b)
-#define EnterCriticalSection RtlEnterCriticalSection
-#define LeaveCriticalSection RtlLeaveCriticalSection
-
#endif /* __WINE_WIN32U_PRIVATE */
More information about the wine-cvs
mailing list