Commit 640d0d5b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

input: end immediately, do not wait for kill event

Once the input main loop is done (or if input init fails), input
controls are not popped anyway. So the input callbacks are no-ops.
There is no point in postponing cleanup.
parent ea553895
...@@ -68,7 +68,6 @@ static void *RunAndDestroy ( vlc_object_t *p_this ); ...@@ -68,7 +68,6 @@ static void *RunAndDestroy ( vlc_object_t *p_this );
static input_thread_t * Create ( vlc_object_t *, input_item_t *, static input_thread_t * Create ( vlc_object_t *, input_item_t *,
const char *, bool, input_ressource_t * ); const char *, bool, input_ressource_t * );
static int Init ( input_thread_t *p_input ); static int Init ( input_thread_t *p_input );
static void WaitDie ( input_thread_t *p_input );
static void End ( input_thread_t *p_input ); static void End ( input_thread_t *p_input );
static void MainLoop( input_thread_t *p_input ); static void MainLoop( input_thread_t *p_input );
...@@ -517,18 +516,14 @@ static void *Run( vlc_object_t *p_this ) ...@@ -517,18 +516,14 @@ static void *Run( vlc_object_t *p_this )
if( Init( p_input ) ) if( Init( p_input ) )
{ {
/* If we failed, wait before we are killed, and exit */ input_ChangeState( p_input, p_input->b_error ? ERROR_S : END_S );
WaitDie( p_input );
goto exit; goto exit;
} }
MainLoop( p_input ); MainLoop( p_input );
/* Wait until we are asked to die */
if( !p_input->b_die )
WaitDie( p_input );
/* Clean up */ /* Clean up */
input_ChangeState( p_input, p_input->b_error ? ERROR_S : END_S );
End( p_input ); End( p_input );
exit: exit:
...@@ -1283,22 +1278,6 @@ error: ...@@ -1283,22 +1278,6 @@ error:
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/*****************************************************************************
* WaitDie: Wait until we are asked to die.
*****************************************************************************
* This function is called when an error occurred during thread main's loop.
*****************************************************************************/
static void WaitDie( input_thread_t *p_input )
{
input_ChangeState( p_input, p_input->b_error ? ERROR_S : END_S );
/* Wait a die order */
vlc_object_lock( p_input );
while( vlc_object_alive( p_input ) )
vlc_object_wait( p_input );
vlc_object_unlock( p_input );
}
/***************************************************************************** /*****************************************************************************
* End: end the input thread * End: end the input thread
*****************************************************************************/ *****************************************************************************/
......
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