Commit 2aca676c authored by Rémi Denis-Courmont's avatar 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.
parent df26e053
......@@ -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 );
......
......@@ -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 },
......
......@@ -165,7 +165,6 @@ struct intf_sys_t
vlc_thread_t thread;
vlc_mutex_t lock;
vlc_cond_t wait;
bool exiting;
};
......
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment