use vlc_object_* and PL_{UN}LOCK to simplify
authorRafaël Carré <funman@videolan.org>
Tue, 11 Mar 2008 18:47:53 +0000 (19:47 +0100)
committerRafaël Carré <funman@videolan.org>
Tue, 11 Mar 2008 18:47:53 +0000 (19:47 +0100)
src/playlist/control.c
src/playlist/engine.c

index 70ccf5a..c30c60f 100644 (file)
@@ -206,7 +206,7 @@ int playlist_AskForArtEnqueue( playlist_t *p_playlist,
     p.p_item = p_item;
     p.b_fetch_art = VLC_TRUE;
 
-    vlc_mutex_lock( &p_playlist->p_fetcher->object_lock );
+    vlc_object_lock( p_playlist->p_fetcher );
     for( i = 0; i < p_playlist->p_fetcher->i_waiting &&
          p_playlist->p_fetcher->p_waiting->b_fetch_art == VLC_TRUE;
          i++ );
@@ -214,8 +214,8 @@ int playlist_AskForArtEnqueue( playlist_t *p_playlist,
     INSERT_ELEM( p_playlist->p_fetcher->p_waiting,
                  p_playlist->p_fetcher->i_waiting,
                  i, p );
-    vlc_cond_signal( &p_playlist->p_fetcher->object_wait );
-    vlc_mutex_unlock( &p_playlist->p_fetcher->object_lock );
+    vlc_object_signal_unlocked( p_playlist->p_fetcher );
+    vlc_obj_unlock( p_playlist->p_fetcher );
     return VLC_SUCCESS;
 }
 
@@ -513,9 +513,9 @@ int playlist_PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
     }
 
     val.i_int = p_input->i_id;
-    vlc_mutex_unlock( &p_playlist->object_lock );
+    PL_UNLOCK;
     var_Set( p_playlist, "playlist-current", val );
-    vlc_mutex_lock( &p_playlist->object_lock );
+    PL_LOCK;
 
     return VLC_SUCCESS;
 }
index 7452bbf..3507bfa 100644 (file)
@@ -696,10 +696,10 @@ void playlist_FetcherLoop( playlist_fetcher_t *p_obj )
                 vlc_gc_decref( p_item );
            }
         }
-        vlc_mutex_lock( &p_obj->object_lock );
+        vlc_object_lock( p_obj );
         i_activity = var_GetInteger( p_playlist, "activity" );
         if( i_activity < 0 ) i_activity = 0;
-        vlc_mutex_unlock( &p_obj->object_lock );
+        vlc_object_unlock( p_obj );
         /* Sleep at least 1ms */
         msleep( (i_activity+1) * 1000 );
     }