]> git.sesse.net Git - vlc/commitdiff
Cleanup handling of thread-less interfaces
authorRémi Denis-Courmont <rem@videolan.org>
Thu, 29 May 2008 16:08:49 +0000 (19:08 +0300)
committerRémi Denis-Courmont <rem@videolan.org>
Thu, 29 May 2008 16:08:49 +0000 (19:08 +0300)
src/interface/interface.c
src/libvlc-common.c

index 7f95e01598d142abae7b7fb1b6e134b6bc768c48..c4d75f18e18810da900b32af60b923e8110dfa70 100644 (file)
@@ -150,10 +150,6 @@ intf_thread_t* __intf_Create( vlc_object_t *p_this, const char *psz_module,
  */
 int intf_RunThread( intf_thread_t *p_intf )
 {
-    /* This interface doesn't need to be run */
-    if( p_intf->pf_run == NULL )
-        return VLC_SUCCESS;
-
     /* Hack to get Mac OS X Cocoa runtime running
      * (it needs access to the main thread) */
     if( p_intf->b_should_run_on_first_thread )
@@ -186,11 +182,8 @@ void intf_StopThread( intf_thread_t *p_intf )
 {
     /* Tell the interface to die */
     vlc_object_kill( p_intf );
-    if( p_intf->pf_run != NULL )
-    {
-        vlc_cond_signal( &p_intf->object_wait );
-        vlc_thread_join( p_intf );
-    }
+    vlc_cond_signal( &p_intf->object_wait );
+    vlc_thread_join( p_intf );
 }
 
 /* Following functions are local */
@@ -229,7 +222,10 @@ static void RunInterface( intf_thread_t *p_intf )
     do
     {
         /* Give control to the interface */
-        p_intf->pf_run( p_intf );
+        if( p_intf->pf_run )
+            p_intf->pf_run( p_intf );
+        else
+            while( vlc_object_lock_and_wait( p_intf ) == 0 );
 
         /* Reset play on start status */
         p_intf->b_play = false;
index 4433a18c92ab0873ef570e68edd47518d0bf3357..8ebb5979d6dccf9cfd5e4c32d9983fc5bee267cb 100644 (file)
@@ -1150,12 +1150,7 @@ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc,
 
     if( b_block )
     {
-        /* FIXME: should be moved to interface/interface.c */
-        if( p_intf->pf_run )
-            vlc_thread_join( p_intf );
-        else
-            while( vlc_object_lock_and_wait( p_intf ) == 0 );
-
+        vlc_thread_join( p_intf );
         vlc_object_detach( p_intf );
         vlc_object_release( p_intf );
     }