Commit 49ede452 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove the libvlc global lock

We have enough static locks in libvlc, I think: the
configuration R/W lock, the module bank mutex, the system-specific
initialization mutex, the message subscription R/W lock, the sets
of mutexes for initializations of specific libraries, the LibVLC
thread variable mutex, the configuration file mutex, the PRNG mutex,
the object pipe mutex, the object name mutex, the dialog provider
mutex, the interface module registration mutex, the OSD mutex, the
VLM mutex, the HTTP hosts mutex and the OSD mutex...
parent e8b8ef77
...@@ -98,7 +98,6 @@ ...@@ -98,7 +98,6 @@
/***************************************************************************** /*****************************************************************************
* The evil global variables. We handle them with care, don't worry. * The evil global variables. We handle them with care, don't worry.
*****************************************************************************/ *****************************************************************************/
static unsigned i_instances = 0;
#ifndef WIN32 #ifndef WIN32
static bool b_daemon = false; static bool b_daemon = false;
...@@ -173,7 +172,6 @@ static void PauseConsole ( void ); ...@@ -173,7 +172,6 @@ static void PauseConsole ( void );
#endif #endif
static int ConsoleWidth ( void ); static int ConsoleWidth ( void );
static vlc_mutex_t global_lock = VLC_STATIC_MUTEX;
extern const char psz_vlc_changeset[]; extern const char psz_vlc_changeset[];
/** /**
...@@ -188,19 +186,9 @@ libvlc_int_t * libvlc_InternalCreate( void ) ...@@ -188,19 +186,9 @@ libvlc_int_t * libvlc_InternalCreate( void )
/* Now that the thread system is initialized, we don't have much, but /* Now that the thread system is initialized, we don't have much, but
* at least we have variables */ * at least we have variables */
vlc_mutex_lock( &global_lock );
if( i_instances == 0 )
{
/* The module bank will be initialized later */
}
/* Allocate a libvlc instance object */ /* Allocate a libvlc instance object */
p_libvlc = vlc_custom_create( (vlc_object_t *)NULL, sizeof (*priv), p_libvlc = vlc_custom_create( (vlc_object_t *)NULL, sizeof (*priv),
"libvlc" ); "libvlc" );
if( p_libvlc != NULL )
i_instances++;
vlc_mutex_unlock( &global_lock );
if( p_libvlc == NULL ) if( p_libvlc == NULL )
return NULL; return NULL;
...@@ -969,15 +957,7 @@ void libvlc_InternalDestroy( libvlc_int_t *p_libvlc ) ...@@ -969,15 +957,7 @@ void libvlc_InternalDestroy( libvlc_int_t *p_libvlc )
{ {
libvlc_priv_t *priv = libvlc_priv( p_libvlc ); libvlc_priv_t *priv = libvlc_priv( p_libvlc );
vlc_mutex_lock( &global_lock );
i_instances--;
if( i_instances == 0 )
{
/* System specific cleaning code */
system_End( ); system_End( );
}
vlc_mutex_unlock( &global_lock );
/* Destroy mutexes */ /* Destroy mutexes */
vlc_ExitDestroy( &priv->exit ); vlc_ExitDestroy( &priv->exit );
......
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