]> git.sesse.net Git - vlc/commitdiff
Don't use a static mutex for libvlc_wait on Win32 (fixes: #3219)
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 2 Jan 2010 21:14:20 +0000 (23:14 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 2 Jan 2010 21:14:20 +0000 (23:14 +0200)
include/vlc_threads.h
src/libvlc.c
src/misc/w32thread.c

index da892ac70997529b489bd9a4d1cccb2c847f1703..9469bb29b93796af775fdf9e2d39f4d909e0bf76 100644 (file)
@@ -106,6 +106,7 @@ typedef pthread_t       vlc_thread_t;
 typedef pthread_mutex_t vlc_mutex_t;
 #define VLC_STATIC_MUTEX PTHREAD_MUTEX_INITIALIZER
 typedef pthread_cond_t  vlc_cond_t;
+#define VLC_STATIC_COND  PTHREAD_COND_INITIALIZER
 typedef sem_t           vlc_sem_t;
 typedef pthread_rwlock_t vlc_rwlock_t;
 typedef pthread_key_t   vlc_threadvar_t;
index 2997f7af10028b56d36c273181abbbe37e9a8c2e..3d7cabdb8e6e19872d032b65338ab4b4ed37ccf7 100644 (file)
@@ -1182,7 +1182,15 @@ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc, char const *psz_module )
     return ret;
 }
 
+#ifndef WIN32
 static vlc_mutex_t exit_lock = VLC_STATIC_MUTEX;
+static vlc_cond_t  exiting = VLC_STATIC_COND;
+#else
+extern vlc_mutex_t super_mutex;
+extern vlc_cond_t  super_variable;
+# define exit_lock super_mutex
+# define exiting   super_variable
+#endif
 
 /**
  * Waits until the LibVLC instance gets an exit signal. Normally, this happens
@@ -1190,11 +1198,9 @@ static vlc_mutex_t exit_lock = VLC_STATIC_MUTEX;
  */
 void libvlc_InternalWait( libvlc_int_t *p_libvlc )
 {
-    libvlc_priv_t *priv = libvlc_priv( p_libvlc );
-
     vlc_mutex_lock( &exit_lock );
     while( vlc_object_alive( p_libvlc ) )
-        vlc_cond_wait( &priv->exiting, &exit_lock );
+        vlc_cond_wait( &exiting, &exit_lock );
     vlc_mutex_unlock( &exit_lock );
 }
 
@@ -1204,11 +1210,9 @@ void libvlc_InternalWait( libvlc_int_t *p_libvlc )
  */
 void libvlc_Quit( libvlc_int_t *p_libvlc )
 {
-    libvlc_priv_t *priv = libvlc_priv( p_libvlc );
-
     vlc_mutex_lock( &exit_lock );
     vlc_object_kill( p_libvlc );
-    vlc_cond_broadcast( &priv->exiting );
+    vlc_cond_broadcast( &exiting );
     vlc_mutex_unlock( &exit_lock );
 }
 
index 64cdadc61f3af4d14e1a05b1e8de00286e7deb0f..c712ca845b5c2c5a7354bb3738a5b2984da44951 100644 (file)
@@ -140,8 +140,8 @@ DWORD WaitForMultipleObjectsEx (DWORD nCount, const HANDLE *lpHandles,
 }
 #endif
 
-static vlc_mutex_t super_mutex;
-static vlc_cond_t  super_variable;
+vlc_mutex_t super_mutex;
+vlc_cond_t  super_variable;
 
 BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved)
 {