]> git.sesse.net Git - vlc/commitdiff
Lua: remove lock_and_wait
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 25 Mar 2012 17:32:29 +0000 (20:32 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 25 Mar 2012 17:37:01 +0000 (20:37 +0300)
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.

modules/lua/intf.c
modules/lua/libs/misc.c
modules/lua/vlc.h
share/lua/README.txt

index 187ef3c4a8f8470d159fb87feb87aa93a45b6c35..a807a9909e58a8d6117f6288481221eff16ae3a1 100644 (file)
@@ -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 );
index abc05d3c5bae48f00e14fd42e0d05b010952cf11..a7e6a5b5f50af9ead89d24b8e25d3525199cd378 100644 (file)
@@ -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 },
 
index 2b8fbff35a997d695445763f6cdb4fbdc4d7c4eb..3683bd2eeffd399ab9d6d85c412c875b4607726f 100644 (file)
@@ -165,7 +165,6 @@ struct intf_sys_t
 
     vlc_thread_t thread;
     vlc_mutex_t lock;
-    vlc_cond_t wait;
     bool exiting;
 };
 
index 6c3ae2581b5b1c58577b11185c86909f1d8628cf..ad32d1dad0bb420ab353e2cfd1e9de2c969901e6 100644 (file)
@@ -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.