From aae54301207c1ce10f7f845c9ab6c5725036e2b2 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 19 Apr 2022 15:30:40 +0200 Subject: [PATCH] winex11: Use pthread_once in create_x11_physdev. Signed-off-by: Jacek Caban Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/winex11.drv/init.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 3447e7bc69f..88d09145f8e 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -37,7 +37,7 @@ static int palette_size; static Pixmap stock_bitmap_pixmap; /* phys bitmap for the default stock bitmap */ -static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; +static pthread_once_t init_once = PTHREAD_ONCE_INIT; static const struct user_driver_funcs x11drv_funcs; static const struct gdi_dc_funcs *xrender_funcs; @@ -59,7 +59,7 @@ void init_recursive_mutex( pthread_mutex_t *mutex ) * * Perform initializations needed upon creation of the first device. */ -static BOOL WINAPI device_init( INIT_ONCE *once, void *param, void **context ) +static void device_init(void) { /* Initialize XRender */ xrender_funcs = X11DRV_XRender_Init(); @@ -70,8 +70,6 @@ static BOOL WINAPI device_init( INIT_ONCE *once, void *param, void **context ) palette_size = X11DRV_PALETTE_Init(); stock_bitmap_pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 1 ); - - return TRUE; } @@ -79,7 +77,7 @@ static X11DRV_PDEVICE *create_x11_physdev( Drawable drawable ) { X11DRV_PDEVICE *physDev; - InitOnceExecuteOnce( &init_once, device_init, NULL, NULL ); + pthread_once( &init_once, device_init ); if (!(physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev) ))) return NULL;