Commit f7ffa590 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winemac: Use pthread_once for wine_vk_init.

parent 43993a39
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment