[vlc-devel] commit: Do NOT destroy the "libvlc"/global/bank/whatever lock variable. ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Mar 30 16:14:40 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Sun Mar 30 17:05:55 2008 +0300| [e4e9182903c4915dd0c1e73eff6b325f0d3be54d]

Do NOT destroy the "libvlc"/global/bank/whatever lock variable.

The whole point of a global lock is that it is... global. Destroying it
every time it's released is severe brain damage, as we end up taking a
different lock all the time (or worse destroying the lock while another
threads is competing for it).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e4e9182903c4915dd0c1e73eff6b325f0d3be54d
---

 src/libvlc-common.c   |    2 --
 src/modules/modules.c |    9 ---------
 2 files changed, 0 insertions(+), 11 deletions(-)

diff --git a/src/libvlc-common.c b/src/libvlc-common.c
index a1625bb..6ffa129 100644
--- a/src/libvlc-common.c
+++ b/src/libvlc-common.c
@@ -177,7 +177,6 @@ libvlc_int_t * libvlc_InternalCreate( void )
         p_libvlc_global->b_ready = VLC_TRUE;
     }
     vlc_mutex_unlock( lockval.p_address );
-    var_Destroy( p_libvlc_global, "libvlc" );
 
     /* Allocate a libvlc instance object */
     p_libvlc = vlc_object_create( p_libvlc_global, VLC_OBJECT_LIBVLC );
@@ -1056,7 +1055,6 @@ int libvlc_InternalDestroy( libvlc_int_t *p_libvlc, vlc_bool_t b_release )
         system_End( p_libvlc );
     }
     vlc_mutex_unlock( lockval.p_address );
-    var_Destroy( p_libvlc_global, "libvlc" );
 
     msg_Flush( p_libvlc );
     msg_Destroy( p_libvlc );
diff --git a/src/modules/modules.c b/src/modules/modules.c
index 87500c4..1aead7e 100644
--- a/src/modules/modules.c
+++ b/src/modules/modules.c
@@ -147,8 +147,6 @@ void __module_InitBank( vlc_object_t *p_this )
         p_libvlc_global->p_module_bank->i_usage++;
 
     vlc_mutex_unlock( lockval.p_address );
-    var_Destroy( p_libvlc_global, "libvlc" );
-
 }
 
 
@@ -172,17 +170,14 @@ void __module_EndBank( vlc_object_t *p_this )
     if( !p_libvlc_global->p_module_bank )
     {
         vlc_mutex_unlock( lockval.p_address );
-        var_Destroy( p_libvlc_global, "libvlc" );
         return;
     }
     if( --p_libvlc_global->p_module_bank->i_usage )
     {
         vlc_mutex_unlock( lockval.p_address );
-        var_Destroy( p_libvlc_global, "libvlc" );
         return;
     }
     vlc_mutex_unlock( lockval.p_address );
-    var_Destroy( p_libvlc_global, "libvlc" );
 
     /* Save the configuration */
     config_AutoSaveConfigFile( p_this );
@@ -261,12 +256,10 @@ void __module_LoadBuiltins( vlc_object_t * p_this )
     if( p_libvlc_global->p_module_bank->b_builtins )
     {
         vlc_mutex_unlock( lockval.p_address );
-        var_Destroy( p_libvlc_global, "libvlc" );
         return;
     }
     p_libvlc_global->p_module_bank->b_builtins = VLC_TRUE;
     vlc_mutex_unlock( lockval.p_address );
-    var_Destroy( p_libvlc_global, "libvlc" );
 
     msg_Dbg( p_this, "checking builtin modules" );
     ALLOCATE_ALL_BUILTINS();
@@ -292,12 +285,10 @@ void __module_LoadPlugins( vlc_object_t * p_this )
     if( p_libvlc_global->p_module_bank->b_plugins )
     {
         vlc_mutex_unlock( lockval.p_address );
-        var_Destroy( p_libvlc_global, "libvlc" );
         return;
     }
     p_libvlc_global->p_module_bank->b_plugins = VLC_TRUE;
     vlc_mutex_unlock( lockval.p_address );
-    var_Destroy( p_libvlc_global, "libvlc" );
 
     msg_Dbg( p_this, "checking plugin modules" );
 




More information about the vlc-devel mailing list