[vlc-devel] commit: audioscrobbler: no need to lock playlist to add callbacks ( Rémi Denis-Courmont )

git version control git at videolan.org
Tue Feb 9 22:27:15 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Feb  9 23:26:42 2010 +0200| [3d1fee81e28302f6feca62823ff1d1661bfa2396] | committer: Rémi Denis-Courmont 

audioscrobbler: no need to lock playlist to add callbacks

We already have the variables lock for that.

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

 modules/misc/audioscrobbler.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/modules/misc/audioscrobbler.c b/modules/misc/audioscrobbler.c
index 1a8016f..76d8ca6 100644
--- a/modules/misc/audioscrobbler.c
+++ b/modules/misc/audioscrobbler.c
@@ -177,7 +177,6 @@ vlc_module_end ()
  *****************************************************************************/
 static int Open( vlc_object_t *p_this )
 {
-    playlist_t      *p_playlist;
     intf_thread_t   *p_intf     = ( intf_thread_t* ) p_this;
     intf_sys_t      *p_sys      = calloc( 1, sizeof( intf_sys_t ) );
 
@@ -189,10 +188,7 @@ static int Open( vlc_object_t *p_this )
     vlc_mutex_init( &p_sys->lock );
     vlc_cond_init( &p_sys->wait );
 
-    p_playlist = pl_Get( p_intf );
-    PL_LOCK;
-    var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
-    PL_UNLOCK;
+    var_AddCallback( pl_Get( p_intf ), "item-current", ItemChange, p_intf );
 
     p_intf->pf_run = Run;
 
@@ -204,12 +200,11 @@ static int Open( vlc_object_t *p_this )
  *****************************************************************************/
 static void Close( vlc_object_t *p_this )
 {
-    playlist_t                  *p_playlist;
+    playlist_t                  *p_playlist = pl_Get( p_this );
     input_thread_t              *p_input;
     intf_thread_t               *p_intf = ( intf_thread_t* ) p_this;
     intf_sys_t                  *p_sys  = p_intf->p_sys;
 
-    p_playlist = pl_Get( p_intf );
     var_DelCallback( p_playlist, "item-current", ItemChange, p_intf );
 
     p_input = playlist_CurrentInput( p_playlist );




More information about the vlc-devel mailing list