[vlc-devel] commit: Remove the last direct use of object_wait ( Rémi Denis-Courmont )

git version control git at videolan.org
Tue Jun 17 21:31:31 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Tue Jun 17 21:43:32 2008 +0300| [a3e989d4523e9252f53017fd030db87ac5691e00]

Remove the last direct use of object_wait

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

 src/libvlc.h                 |   10 ++++++++++
 src/playlist/control.c       |    2 +-
 src/playlist/item.c          |    8 ++++----
 src/playlist/search.c        |    2 +-
 src/video_output/vout_intf.c |    8 ++++----
 5 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/libvlc.h b/src/libvlc.h
index 0964abd..c42058e 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -142,6 +142,16 @@ extern void *
 vlc_custom_create (vlc_object_t *p_this, size_t i_size, int i_type,
                    const char *psz_type);
 
+/* Signal an object without checking for locking consistency. This is wrong. */
+#ifdef __GNUC__
+__attribute__((deprecated))
+#endif
+static inline void
+vlc_object_signal_maybe (vlc_object_t *p_this)
+{
+    vlc_cond_signal (&p_this->object_wait);
+}
+
 /**
  * libvlc_global_data_t (global variable)
  *
diff --git a/src/playlist/control.c b/src/playlist/control.c
index 41bbf5f..8051f51 100644
--- a/src/playlist/control.c
+++ b/src/playlist/control.c
@@ -162,7 +162,7 @@ static int PlaylistVAControl( playlist_t * p_playlist, int i_query, va_list args
         return VLC_EBADVAR;
         break;
     }
-    vlc_cond_signal( &p_playlist->object_wait );
+    vlc_object_signal_maybe( VLC_OBJECT(p_playlist) );
 
     return VLC_SUCCESS;
 }
diff --git a/src/playlist/item.c b/src/playlist/item.c
index b3c79dd..20ee6f2 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -724,7 +724,7 @@ int playlist_TreeMove( playlist_t * p_playlist, playlist_item_t *p_item,
     else
         i_ret = TreeMove( p_playlist, p_item, p_node, i_newpos );
     p_playlist->b_reset_currently_playing = true;
-    vlc_cond_signal( &p_playlist->object_wait );
+    vlc_object_signal_maybe( VLC_OBJECT(p_playlist) );
     return i_ret;
 }
 
@@ -750,7 +750,7 @@ void playlist_SendAddNotify( playlist_t *p_playlist, int i_item_id,
     val.p_address = p_add;
     p_playlist->b_reset_currently_playing = true;
     if( b_signal )
-        vlc_cond_signal( &p_playlist->object_wait );
+        vlc_object_signal_maybe( p_playlist );
     var_Set( p_playlist, "item-append", val );
     free( p_add );
 }
@@ -808,7 +808,7 @@ static void GoAndPreparse( playlist_t *p_playlist, int i_mode,
         if( p_playlist->p_input )
             input_StopThread( p_playlist->p_input );
         p_playlist->request.i_status = PLAYLIST_RUNNING;
-        vlc_cond_signal( &p_playlist->object_wait );
+        vlc_object_signal_maybe( VLC_OBJECT(p_playlist) );
     }
     /* Preparse if PREPARSE or SPREPARSE & not enough meta */
     char *psz_artist = input_item_GetArtist( p_item_cat->p_input );
@@ -890,7 +890,7 @@ static int DeleteInner( playlist_t * p_playlist, playlist_item_t *p_item,
             p_playlist->request.b_request = true;
             p_playlist->request.p_item = NULL;
             msg_Info( p_playlist, "stopping playback" );
-            vlc_cond_signal( &p_playlist->object_wait );
+            vlc_object_signal_maybe( VLC_OBJECT(p_playlist) );
         }
         b_delay_deletion = true;
     }
diff --git a/src/playlist/search.c b/src/playlist/search.c
index 207205d..0cd55ca 100644
--- a/src/playlist/search.c
+++ b/src/playlist/search.c
@@ -167,6 +167,6 @@ int playlist_LiveSearchUpdate( playlist_t *p_playlist, playlist_item_t *p_root,
 {
     p_playlist->b_reset_currently_playing = true;
     playlist_LiveSearchUpdateInternal( p_playlist, p_root, psz_string );
-    vlc_cond_signal( &p_playlist->object_wait );
+    vlc_object_signal_maybe( VLC_OBJECT(p_playlist) );
     return VLC_SUCCESS;
 }
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index b3dbe13..2457bbd 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -544,7 +544,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
         {
             msg_Err( p_vout, "Could not get snapshot" );
             image_HandlerDelete( p_image );
-            vlc_cond_signal( &p_dest->object_wait );
+            vlc_object_signal_maybe( VLC_OBJECT(p_dest) );
             vlc_object_release( p_dest );
             return VLC_EGENERIC;
         }
@@ -556,7 +556,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
         {
             block_Release( p_block );
             image_HandlerDelete( p_image );
-            vlc_cond_signal( &p_dest->object_wait );
+            vlc_object_signal_maybe( VLC_OBJECT(p_dest) );
             vlc_object_release( p_dest );
             return VLC_ENOMEM;
         }
@@ -573,7 +573,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
             block_Release( p_block );
             free( p_snapshot );
             image_HandlerDelete( p_image );
-            vlc_cond_signal( &p_dest->object_wait );
+            vlc_object_signal_maybe( VLC_OBJECT(p_dest) );
             vlc_object_release( p_dest );
             return VLC_ENOMEM;
         }
@@ -584,7 +584,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
         block_Release( p_block );
 
         /* Unlock the object */
-        vlc_cond_signal( &p_dest->object_wait );
+        vlc_object_signal_maybe( VLC_OBJECT(p_dest) );
         vlc_object_release( p_dest );
 
         image_HandlerDelete( p_image );




More information about the vlc-devel mailing list