Commit 9899f7b7 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Aaron Plattner
Browse files

vdpau_wrapper: make initialization of library handles thread-safe


Reviewed-by: default avatarAaron Plattner <aplattner@nvidia.com>
Signed-off-by: default avatarAaron Plattner <aplattner@nvidia.com>
parent c285f0a7
...@@ -398,17 +398,21 @@ VdpStatus vdp_device_create_x11( ...@@ -398,17 +398,21 @@ VdpStatus vdp_device_create_x11(
) )
{ {
static pthread_once_t once = PTHREAD_ONCE_INIT; static pthread_once_t once = PTHREAD_ONCE_INIT;
VdpStatus status; static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
VdpStatus status = VDP_STATUS_OK;
pthread_once(&once, init_fixes); pthread_once(&once, init_fixes);
pthread_mutex_lock(&lock);
if (!_vdp_imp_device_create_x11_proc) { if (!_vdp_imp_device_create_x11_proc) {
status = _vdp_open_driver(display, screen); status = _vdp_open_driver(display, screen);
if (status != VDP_STATUS_OK) { if (status != VDP_STATUS_OK)
_vdp_close_driver(); _vdp_close_driver();
return status;
}
} }
pthread_mutex_unlock(&lock);
if (status != VDP_STATUS_OK)
return status;
status = _vdp_imp_device_create_x11_proc( status = _vdp_imp_device_create_x11_proc(
display, display,
......
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