Commit 1d0c9675 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Win32: fix race condition initializing static mutexes

parent 059627d3
...@@ -360,7 +360,8 @@ void vlc_mutex_lock (vlc_mutex_t *p_mutex) ...@@ -360,7 +360,8 @@ void vlc_mutex_lock (vlc_mutex_t *p_mutex)
assert (p_mutex != &super_mutex); /* this one cannot be static */ assert (p_mutex != &super_mutex); /* this one cannot be static */
vlc_mutex_lock (&super_mutex); vlc_mutex_lock (&super_mutex);
vlc_mutex_init (p_mutex); if (InterlockedCompareExchange (&p_mutex->initialized, 0, 0) == 0)
vlc_mutex_init (p_mutex);
/* FIXME: destroy the mutex some time... */ /* FIXME: destroy the mutex some time... */
vlc_mutex_unlock (&super_mutex); vlc_mutex_unlock (&super_mutex);
} }
......
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