]> git.sesse.net Git - vlc/commitdiff
Interfaces are now allowed not to have a Run function.
authorClément Stenac <zorglub@videolan.org>
Sun, 17 Sep 2006 10:17:39 +0000 (10:17 +0000)
committerClément Stenac <zorglub@videolan.org>
Sun, 17 Sep 2006 10:17:39 +0000 (10:17 +0000)
This will help reduce useless process wakeups

modules/misc/notify/notify.c
src/interface/interface.c

index 9baab058bfba607a849d1da72cf02f786cf29076..77247e004076453b9712ee821ee84f4eafd5f0a1 100644 (file)
@@ -38,7 +38,6 @@
  *****************************************************************************/
 static int  Open    ( vlc_object_t * );
 static void Close   ( vlc_object_t * );
-static void Run     ( intf_thread_t * );
 
 static int ItemChange( vlc_object_t *, const char *,
                        vlc_value_t, vlc_value_t, void * );
@@ -49,7 +48,6 @@ static int Notify( vlc_object_t *, const char * );
  * Module descriptor
  ****************************************************************************/
 
-
 #define APPLICATION_NAME "VLC media player"
 
 #define TIMEOUT_TEXT N_("Timeout (ms)")
@@ -86,7 +84,6 @@ static int Open( vlc_object_t *p_this )
     var_AddCallback( p_playlist, "playlist-current", ItemChange, p_intf );
     pl_Release( p_intf );
 
-    p_intf->pf_run = Run;
     return VLC_SUCCESS;
 }
 
@@ -102,14 +99,6 @@ static void Close( vlc_object_t *p_this )
     notify_uninit();
 }
 
-/*****************************************************************************
- * Run
- *****************************************************************************/
-static void Run( intf_thread_t *p_this )
-{
-    msleep( 10*INTF_IDLE_SLEEP );
-}
-
 /*****************************************************************************
  * ItemChange: Playlist item change callback
  *****************************************************************************/
index c660b67765e1520627465b20d93e4226a281b30f..fbf9686f587a7ab25c5458006ada28e0dc7d4d4d 100644 (file)
@@ -186,6 +186,11 @@ int intf_RunThread( intf_thread_t *p_intf )
     }
     else
     {
+        /* This interface doesn't need to be run */
+        if( !p_intf->pf_run )
+        {
+            return VLC_SUCCESS;
+        }
         /* Run the interface in a separate thread */
         if( !strcmp( p_intf->p_module->psz_object_name, "macosx" ) )
         {
@@ -226,6 +231,10 @@ int intf_RunThread( intf_thread_t *p_intf )
     }
     else
     {
+        /* This interface doesn't need to be run */
+        if( !p_intf->pf_run )
+            return VLC_SUCCESS;
+
         /* Run the interface in a separate thread */
         if( vlc_thread_create( p_intf, "interface", RunInterface,
                                VLC_THREAD_PRIORITY_LOW, VLC_FALSE ) )
@@ -255,7 +264,8 @@ void intf_StopThread( intf_thread_t *p_intf )
     }
 
     /* Wait for the thread to exit */
-    vlc_thread_join( p_intf );
+    if( p_intf->pf_run )
+        vlc_thread_join( p_intf );
 }
 
 /**