Commit 0cd4a19b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Fix logic.

We don't need an explicit barrier when setting initialized from
vlc_mutex_init(). The caller shall synchronize memory after
vlc_mutex_init() from any thread calling vlc_mutex_lock() anyway,
since locking an unitialized non-static mutex is undefined.
parent f10b7234
......@@ -205,6 +205,7 @@ int vlc_mutex_init( vlc_mutex_t *p_mutex )
/* This creates a recursive mutex. This is OK as fast mutexes have
* no defined behavior in case of recursive locking. */
InitializeCriticalSection (&p_mutex->mutex);
p_mutex->initialized = 1;
return 0;
#endif
......@@ -231,8 +232,7 @@ int vlc_mutex_init_recursive( vlc_mutex_t *p_mutex )
#elif defined( WIN32 )
InitializeCriticalSection( &p_mutex->mutex );
InterlockedIncrement (&p_mutex->initialized);
barrier ();
p_mutex->initialized = 1;
return 0;
#endif
......@@ -252,7 +252,7 @@ void vlc_mutex_destroy (vlc_mutex_t *p_mutex)
VLC_THREAD_ASSERT ("destroying mutex");
#elif defined( WIN32 )
InterlockedDecrement (&p_mutex->initialized);
assert (p_mutex->initialized);
DeleteCriticalSection (&p_mutex->mutex);
#endif
......
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