Commit 36827a83 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Don't use a static mutex for libvlc_wait on Win32 (fixes: #3219)

parent 52b3415e
......@@ -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;
......
......@@ -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 );
}
......
......@@ -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)
{
......
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