[vlc-devel] commit: vlc_object_lock_and_wait: broken by design, remove ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu Aug 28 22:38:54 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Thu Aug 28 23:39:44 2008 +0300| [1014a2aa09d4c4a529407b221676f9138416660b] | committer: Rémi Denis-Courmont 

vlc_object_lock_and_wait: broken by design, remove

The only user is LUA, inlined there. The return value seems suspicious
by the way.

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

 include/vlc_objects.h        |   23 -----------------------
 modules/misc/lua/libs/misc.c |   10 +++++++++-
 2 files changed, 9 insertions(+), 24 deletions(-)

diff --git a/include/vlc_objects.h b/include/vlc_objects.h
index c31436c..a75a9b0 100644
--- a/include/vlc_objects.h
+++ b/include/vlc_objects.h
@@ -177,26 +177,3 @@ static inline bool __vlc_object_alive (const vlc_object_t *obj)
 VLC_EXPORT( int, __vlc_object_waitpipe, ( vlc_object_t *obj ));
 #define vlc_object_waitpipe(a) \
     __vlc_object_waitpipe( VLC_OBJECT(a) )
-
-/* NOTE: this function is a *temporary* convenience.
- * See the vlc_object_alive() documentation for a better alternative.
- */
-static inline
-bool __vlc_object_lock_and_wait( vlc_object_t *obj )
-{
-    bool b;
-
-    vlc_object_lock( obj );
-    b = vlc_object_alive( obj );
-    if( b )
-    {
-        vlc_object_wait( obj );
-        b = vlc_object_alive( obj );
-    }
-    vlc_object_unlock( obj );
-    return b;
-}
-#define vlc_object_lock_and_wait( obj ) \
-    __vlc_object_lock_and_wait( VLC_OBJECT(obj) )
-
-
diff --git a/modules/misc/lua/libs/misc.c b/modules/misc/lua/libs/misc.c
index 6efec4a..08804a1 100644
--- a/modules/misc/lua/libs/misc.c
+++ b/modules/misc/lua/libs/misc.c
@@ -171,7 +171,15 @@ static int vlclua_datadir_list( lua_State *L )
 static int vlclua_lock_and_wait( lua_State *L )
 {
     vlc_object_t *p_this = vlclua_get_this( L );
-    int b_quit = vlc_object_lock_and_wait( p_this );
+    int b_quit;
+
+    vlc_object_lock( p_this );
+    b_quit = vlc_object_alive( p_this );
+    if( b_quit )
+    {
+        vlc_object_wait( p_this );
+        b_quit = vlc_object_alive( p_this );
+    }
     lua_pushboolean( L, b_quit );
     return 1;
 }




More information about the vlc-devel mailing list