]> git.sesse.net Git - vlc/blobdiff - modules/misc/lua/libs/misc.c
LUA intf: fix lock_and_wait, and stop using vlc_object_wait()
[vlc] / modules / misc / lua / libs / misc.c
index db8bb9f4eed6a861fd4b998ef3e95524c250373d..8a21cceeebc5d2b465b56a7d9acde6a8187209ad 100644 (file)
@@ -170,18 +170,14 @@ 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( p_this );
-    b_quit = vlc_object_alive( p_this );
-    if( b_quit )
-    {
-        vlc_object_wait( p_this );
-        b_quit = vlc_object_alive( p_this );
-    }
-    vlc_object_unlock( p_this );
-    lua_pushboolean( L, b_quit );
+    intf_thread_t *p_intf = (intf_thread_t *)vlclua_get_this( L );
+    intf_sys_t *p_sys = p_intf->p_sys;
+
+    vlc_mutex_lock( &p_sys->lock );
+    while( !p_sys->exiting )
+        vlc_cond_wait( &p_sys->wait, &p_sys->lock );
+    vlc_mutex_unlock( &p_sys->lock );
+    lua_pushboolean( L, 1 );
     return 1;
 }