[vlc-devel] commit: Cleanup handling of thread-less interfaces ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu May 29 18:33:05 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Thu May 29 19:08:49 2008 +0300| [522baa537196376d0e517c68547a78bb830dddd7]

Cleanup handling of thread-less interfaces

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=522baa537196376d0e517c68547a78bb830dddd7
---

 src/interface/interface.c |   16 ++++++----------
 src/libvlc-common.c       |    7 +------
 2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/src/interface/interface.c b/src/interface/interface.c
index 7f95e01..c4d75f1 100644
--- a/src/interface/interface.c
+++ b/src/interface/interface.c
@@ -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;
diff --git a/src/libvlc-common.c b/src/libvlc-common.c
index 4433a18..8ebb597 100644
--- a/src/libvlc-common.c
+++ b/src/libvlc-common.c
@@ -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 );
     }




More information about the vlc-devel mailing list