Commit 187a6ea2 authored by Clément Stenac's avatar Clément Stenac

Interfaces are now allowed not to have a Run function.

This will help reduce useless process wakeups
parent c17e7670
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
*****************************************************************************/ *****************************************************************************/
static int Open ( vlc_object_t * ); static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * ); static void Close ( vlc_object_t * );
static void Run ( intf_thread_t * );
static int ItemChange( vlc_object_t *, const char *, static int ItemChange( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * ); vlc_value_t, vlc_value_t, void * );
...@@ -49,7 +48,6 @@ static int Notify( vlc_object_t *, const char * ); ...@@ -49,7 +48,6 @@ static int Notify( vlc_object_t *, const char * );
* Module descriptor * Module descriptor
****************************************************************************/ ****************************************************************************/
#define APPLICATION_NAME "VLC media player" #define APPLICATION_NAME "VLC media player"
#define TIMEOUT_TEXT N_("Timeout (ms)") #define TIMEOUT_TEXT N_("Timeout (ms)")
...@@ -86,7 +84,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -86,7 +84,6 @@ static int Open( vlc_object_t *p_this )
var_AddCallback( p_playlist, "playlist-current", ItemChange, p_intf ); var_AddCallback( p_playlist, "playlist-current", ItemChange, p_intf );
pl_Release( p_intf ); pl_Release( p_intf );
p_intf->pf_run = Run;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -102,14 +99,6 @@ static void Close( vlc_object_t *p_this ) ...@@ -102,14 +99,6 @@ static void Close( vlc_object_t *p_this )
notify_uninit(); notify_uninit();
} }
/*****************************************************************************
* Run
*****************************************************************************/
static void Run( intf_thread_t *p_this )
{
msleep( 10*INTF_IDLE_SLEEP );
}
/***************************************************************************** /*****************************************************************************
* ItemChange: Playlist item change callback * ItemChange: Playlist item change callback
*****************************************************************************/ *****************************************************************************/
......
...@@ -186,6 +186,11 @@ int intf_RunThread( intf_thread_t *p_intf ) ...@@ -186,6 +186,11 @@ int intf_RunThread( intf_thread_t *p_intf )
} }
else else
{ {
/* This interface doesn't need to be run */
if( !p_intf->pf_run )
{
return VLC_SUCCESS;
}
/* Run the interface in a separate thread */ /* Run the interface in a separate thread */
if( !strcmp( p_intf->p_module->psz_object_name, "macosx" ) ) if( !strcmp( p_intf->p_module->psz_object_name, "macosx" ) )
{ {
...@@ -226,6 +231,10 @@ int intf_RunThread( intf_thread_t *p_intf ) ...@@ -226,6 +231,10 @@ int intf_RunThread( intf_thread_t *p_intf )
} }
else else
{ {
/* This interface doesn't need to be run */
if( !p_intf->pf_run )
return VLC_SUCCESS;
/* Run the interface in a separate thread */ /* Run the interface in a separate thread */
if( vlc_thread_create( p_intf, "interface", RunInterface, if( vlc_thread_create( p_intf, "interface", RunInterface,
VLC_THREAD_PRIORITY_LOW, VLC_FALSE ) ) VLC_THREAD_PRIORITY_LOW, VLC_FALSE ) )
...@@ -255,6 +264,7 @@ void intf_StopThread( intf_thread_t *p_intf ) ...@@ -255,6 +264,7 @@ void intf_StopThread( intf_thread_t *p_intf )
} }
/* Wait for the thread to exit */ /* Wait for the thread to exit */
if( p_intf->pf_run )
vlc_thread_join( p_intf ); vlc_thread_join( p_intf );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment