[vlc-devel] commit: Use a private lock for input item ID allocation ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed Mar 4 22:42:02 CET 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Mar  4 23:14:46 2009 +0200| [4863b62dcfafb899a7483372aef78bea2d8aea16] | committer: Rémi Denis-Courmont 

Use a private lock for input item ID allocation

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

 src/input/item.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/input/item.c b/src/input/item.c
index 55a5b8f..c07554a 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -645,6 +645,7 @@ input_item_t *input_item_NewWithType( vlc_object_t *p_obj, const char *psz_uri,
                                 int i_type )
 {
     libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc);
+    static vlc_mutex_t input_id_lock = VLC_STATIC_MUTEX;
 
     input_item_t* p_input = malloc( sizeof(input_item_t ) );
     if( !p_input )
@@ -653,9 +654,9 @@ input_item_t *input_item_NewWithType( vlc_object_t *p_obj, const char *psz_uri,
     input_item_Init( p_obj, p_input );
     vlc_gc_init( p_input, input_item_Destroy );
 
-    vlc_object_lock( p_obj->p_libvlc );
+    vlc_mutex_lock( &input_id_lock );
     p_input->i_id = ++priv->i_last_input_id;
-    vlc_object_unlock( p_obj->p_libvlc );
+    vlc_mutex_unlock( &input_id_lock );
 
     p_input->b_fixed_name = false;
 




More information about the vlc-devel mailing list