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;
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 );
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() );
{ "mdate", vlclua_mdate },
{ "mwait", vlclua_mwait },
- { "lock_and_wait", vlclua_lock_and_wait },
-
{ "should_die", vlclua_intf_should_die },
{ "quit", vlclua_quit },
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.