[vlc-devel] commit: Robustify Win32 mutex assertions ( Rémi Denis-Courmont )
git version control
git at videolan.org
Tue Dec 16 20:49:43 CET 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Tue Dec 16 21:49:13 2008 +0200| [059627d3af3e32285f3ffa73436157f31c7f8bc0] | committer: Rémi Denis-Courmont
Robustify Win32 mutex assertions
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=059627d3af3e32285f3ffa73436157f31c7f8bc0
---
src/misc/threads.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/misc/threads.c b/src/misc/threads.c
index c7d7957..a7c133e 100644
--- a/src/misc/threads.c
+++ b/src/misc/threads.c
@@ -334,7 +334,7 @@ void vlc_mutex_destroy (vlc_mutex_t *p_mutex)
VLC_THREAD_ASSERT ("destroying mutex");
#elif defined( WIN32 )
- assert (p_mutex->initialized);
+ assert (InterlockedExchange (&p_mutex->initialized, -1) == 1);
DeleteCriticalSection (&p_mutex->mutex);
#endif
@@ -364,6 +364,7 @@ void vlc_mutex_lock (vlc_mutex_t *p_mutex)
/* FIXME: destroy the mutex some time... */
vlc_mutex_unlock (&super_mutex);
}
+ assert (InterlockedExchange (&p_mutex->initialized, 1) == 1);
EnterCriticalSection (&p_mutex->mutex);
#endif
@@ -381,6 +382,7 @@ void vlc_mutex_unlock (vlc_mutex_t *p_mutex)
VLC_THREAD_ASSERT ("unlocking mutex");
#elif defined( WIN32 )
+ assert (InterlockedExchange (&p_mutex->initialized, 1) == 1);
LeaveCriticalSection (&p_mutex->mutex);
#endif
More information about the vlc-devel
mailing list