[vlc-devel] commit: Privatize the LibVLC exit lock ( Rémi Denis-Courmont )
git version control
git at videolan.org
Thu Mar 5 18:14:43 CET 2009
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Mar 5 18:55:06 2009 +0200| [31bdf929bcaa170cfb0eb2ba05470a843d7966e3] | committer: Rémi Denis-Courmont
Privatize the LibVLC exit lock
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=31bdf929bcaa170cfb0eb2ba05470a843d7966e3
---
src/libvlc.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/libvlc.c b/src/libvlc.c
index 1d1d71d..3bc2d43 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -1185,6 +1185,8 @@ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc, char const *psz_module )
return VLC_SUCCESS;
};
+static vlc_mutex_t exit_lock = VLC_STATIC_MUTEX;
+
/**
* Waits until the LibVLC instance gets an exit signal. Normally, this happens
* when the user "exits" an interface plugin.
@@ -1192,12 +1194,11 @@ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc, char const *psz_module )
void libvlc_InternalWait( libvlc_int_t *p_libvlc )
{
libvlc_priv_t *priv = libvlc_priv( p_libvlc );
- vlc_object_internals_t *internals = vlc_internals( p_libvlc );
- vlc_object_lock( p_libvlc );
+ vlc_mutex_lock( &exit_lock );
while( vlc_object_alive( p_libvlc ) )
- vlc_cond_wait( &priv->exiting, &internals->lock );
- vlc_object_unlock( p_libvlc );
+ vlc_cond_wait( &priv->exiting, &exit_lock );
+ vlc_mutex_unlock( &exit_lock );
}
/**
@@ -1208,8 +1209,10 @@ 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_signal( &priv->exiting ); /* OK, kill took care of the lock */
+ vlc_cond_signal( &priv->exiting );
+ vlc_mutex_unlock( &exit_lock );
}
#if defined( ENABLE_NLS ) && (defined (__APPLE__) || defined (WIN32)) && \
More information about the vlc-devel
mailing list