[vlc-commits] Lua: remove lock_and_wait

Rémi Denis-Courmont git at videolan.org
Sun Mar 25 19:40:35 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Mar 25 20:32:29 2012 +0300| [2aca676cccdefe49d40c4f57d41a6cd47c16816c] | committer: Rémi Denis-Courmont

Lua: remove lock_and_wait

If the interface script has nothing to do, then it can simply end and
the let the interface thread finish ahead of pf_deactivate.
This will _not_ automatically cause VLC to exit.

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

 modules/lua/intf.c      |    4 ----
 modules/lua/libs/misc.c |   18 ------------------
 modules/lua/vlc.h       |    1 -
 share/lua/README.txt    |    2 --
 4 files changed, 0 insertions(+), 25 deletions(-)

diff --git a/modules/lua/intf.c b/modules/lua/intf.c
index 187ef3c..a807a99 100644
--- a/modules/lua/intf.c
+++ b/modules/lua/intf.c
@@ -363,12 +363,10 @@ static int Start_LuaIntf( vlc_object_t *p_this, const char *name )
     p_sys->L = L;
 
     vlc_mutex_init( &p_sys->lock );
-    vlc_cond_init( &p_sys->wait );
     p_sys->exiting = false;
 
     if( vlc_clone( &p_sys->thread, Run, p_intf, VLC_THREAD_PRIORITY_LOW ) )
     {
-        vlc_cond_destroy( &p_sys->wait );
         vlc_mutex_destroy( &p_sys->lock );
         lua_close( p_sys->L );
         goto error;
@@ -392,10 +390,8 @@ void Close_LuaIntf( vlc_object_t *p_this )
 
     vlc_mutex_lock( &p_sys->lock );
     p_sys->exiting = true;
-    vlc_cond_signal( &p_sys->wait );
     vlc_mutex_unlock( &p_sys->lock );
     vlc_join( p_sys->thread, NULL );
-    vlc_cond_destroy( &p_sys->wait );
     vlc_mutex_destroy( &p_sys->lock );
 
     lua_close( p_sys->L );
diff --git a/modules/lua/libs/misc.c b/modules/lua/libs/misc.c
index abc05d3..a7e6a5b 100644
--- a/modules/lua/libs/misc.c
+++ b/modules/lua/libs/misc.c
@@ -132,22 +132,6 @@ static int vlclua_quit( lua_State *L )
     return 0;
 }
 
-/*****************************************************************************
- *
- *****************************************************************************/
-static int vlclua_lock_and_wait( lua_State *L )
-{
-    intf_sys_t *p_sys = vlclua_get_intf( L );
-
-    vlc_mutex_lock( &p_sys->lock );
-    mutex_cleanup_push( &p_sys->lock );
-    while( !p_sys->exiting )
-        vlc_cond_wait( &p_sys->wait, &p_sys->lock );
-    vlc_cleanup_run();
-    lua_pushboolean( L, 1 );
-    return 1;
-}
-
 static int vlclua_mdate( lua_State *L )
 {
     lua_pushnumber( L, mdate() );
@@ -190,8 +174,6 @@ static const luaL_Reg vlclua_misc_reg[] = {
     { "mdate", vlclua_mdate },
     { "mwait", vlclua_mwait },
 
-    { "lock_and_wait", vlclua_lock_and_wait },
-
     { "should_die", vlclua_intf_should_die },
     { "quit", vlclua_quit },
 
diff --git a/modules/lua/vlc.h b/modules/lua/vlc.h
index 2b8fbff..3683bd2 100644
--- a/modules/lua/vlc.h
+++ b/modules/lua/vlc.h
@@ -165,7 +165,6 @@ struct intf_sys_t
 
     vlc_thread_t thread;
     vlc_mutex_t lock;
-    vlc_cond_t wait;
     bool exiting;
 };
 
diff --git a/share/lua/README.txt b/share/lua/README.txt
index 6c3ae25..ad32d1d 100644
--- a/share/lua/README.txt
+++ b/share/lua/README.txt
@@ -165,8 +165,6 @@ misc.action_id( name ): get the id of the given action.
 misc.mdate(): Get the current date (in microseconds).
 misc.mwait(): Wait for the given date (in microseconds).
 
-misc.lock_and_wait(): Lock our object thread and wait for a wake up signal.
-
 misc.should_die(): Returns true if the interface should quit.
 misc.quit(): Quit VLC.
 



More information about the vlc-commits mailing list