Jacek Caban : winemac: Use pthread_once for wine_vk_init.
Alexandre Julliard
julliard at winehq.org
Wed May 18 15:38:30 CDT 2022
Module: wine
Branch: master
Commit: f7ffa59079837d0b509443ea084f14ed9cc0e8ef
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f7ffa59079837d0b509443ea084f14ed9cc0e8ef
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed May 18 00:21:29 2022 +0200
winemac: Use pthread_once for wine_vk_init.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winemac.drv/vulkan.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/dlls/winemac.drv/vulkan.c b/dlls/winemac.drv/vulkan.c
index 67273b8f20b..de99e4035bc 100644
--- a/dlls/winemac.drv/vulkan.c
+++ b/dlls/winemac.drv/vulkan.c
@@ -101,12 +101,12 @@ static inline struct wine_vk_surface *surface_from_handle(VkSurfaceKHR handle)
static void *vulkan_handle;
-static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context)
+static void wine_vk_init(void)
{
if (!(vulkan_handle = dlopen(SONAME_LIBMOLTENVK, RTLD_NOW)))
{
ERR("Failed to load %s\n", SONAME_LIBMOLTENVK);
- return TRUE;
+ return;
}
#define LOAD_FUNCPTR(f) if ((p##f = dlsym(vulkan_handle, #f)) == NULL) goto fail;
@@ -130,12 +130,11 @@ static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context)
LOAD_FUNCPTR(vkQueuePresentKHR)
#undef LOAD_FUNCPTR
- return TRUE;
+ return;
fail:
dlclose(vulkan_handle);
vulkan_handle = NULL;
- return TRUE;
}
/* Helper function for converting between win32 and MoltenVK compatible VkInstanceCreateInfo.
@@ -625,7 +624,7 @@ static void *macdrv_get_vk_instance_proc_addr(VkInstance instance, const char *n
static const struct vulkan_funcs *get_vulkan_driver(UINT version)
{
- static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
+ static pthread_once_t init_once = PTHREAD_ONCE_INIT;
if (version != WINE_VULKAN_DRIVER_VERSION)
{
@@ -633,7 +632,7 @@ static const struct vulkan_funcs *get_vulkan_driver(UINT version)
return NULL;
}
- InitOnceExecuteOnce(&init_once, wine_vk_init, NULL, NULL);
+ pthread_once(&init_once, wine_vk_init);
if (vulkan_handle)
return &vulkan_funcs;
More information about the wine-cvs
mailing list