Commit f5bea704 authored by Laurent Aimar's avatar Laurent Aimar

Send INPUT_EVENT_ABORT from input thread instead of input_StopThread.

It is cleaner to not send event from caller threadand will fix a deadlock in the
playlist code.
parent ac14ce27
...@@ -209,6 +209,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item, ...@@ -209,6 +209,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
vlc_mutex_init( &p_input->p->lock_control ); vlc_mutex_init( &p_input->p->lock_control );
vlc_cond_init( &p_input->p->wait_control ); vlc_cond_init( &p_input->p->wait_control );
p_input->p->i_control = 0; p_input->p->i_control = 0;
p_input->p->b_abort = false;
/* Parse input options */ /* Parse input options */
vlc_mutex_lock( &p_item->lock ); vlc_mutex_lock( &p_item->lock );
...@@ -436,9 +437,11 @@ void input_StopThread( input_thread_t *p_input, bool b_abort ) ...@@ -436,9 +437,11 @@ void input_StopThread( input_thread_t *p_input, bool b_abort )
* unlock the control loop */ * unlock the control loop */
ObjectKillChildrens( p_input, VLC_OBJECT(p_input) ); ObjectKillChildrens( p_input, VLC_OBJECT(p_input) );
vlc_mutex_lock( &p_input->p->lock_control );
p_input->p->b_abort |= b_abort;
vlc_mutex_unlock( &p_input->p->lock_control );
input_ControlPush( p_input, INPUT_CONTROL_SET_DIE, NULL ); input_ControlPush( p_input, INPUT_CONTROL_SET_DIE, NULL );
if( b_abort )
input_SendEventAbort( p_input );
} }
input_resource_t *input_DetachResource( input_thread_t *p_input ) input_resource_t *input_DetachResource( input_thread_t *p_input )
...@@ -508,7 +511,10 @@ static void *Run( vlc_object_t *p_this ) ...@@ -508,7 +511,10 @@ static void *Run( vlc_object_t *p_this )
exit: exit:
/* Tell we're dead */ /* Tell we're dead */
if( p_input->p->b_abort )
input_SendEventAbort( p_input );
input_SendEventDead( p_input ); input_SendEventDead( p_input );
vlc_restorecancel( canc ); vlc_restorecancel( canc );
return NULL; return NULL;
} }
......
...@@ -165,6 +165,7 @@ struct input_thread_private_t ...@@ -165,6 +165,7 @@ struct input_thread_private_t
int i_type; int i_type;
vlc_value_t val; vlc_value_t val;
} control[INPUT_CONTROL_FIFO_SIZE]; } control[INPUT_CONTROL_FIFO_SIZE];
bool b_abort;
}; };
/*************************************************************************** /***************************************************************************
......
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