]> git.sesse.net Git - vlc/commitdiff
Send INPUT_EVENT_ABORT from input thread instead of input_StopThread.
authorLaurent Aimar <fenrir@videolan.org>
Thu, 12 Mar 2009 19:13:29 +0000 (20:13 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Thu, 12 Mar 2009 19:14:56 +0000 (20:14 +0100)
It is cleaner to not send event from caller threadand will fix a deadlock in the
playlist code.

src/input/input.c
src/input/input_internal.h

index 77965ac80fdb1240d3d9f90421c827e8be6a3e0e..8cae4df5f17c28790171ea2c4fe40a0b47d898c2 100644 (file)
@@ -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_cond_init( &p_input->p->wait_control );
     p_input->p->i_control = 0;
+    p_input->p->b_abort = false;
 
     /* Parse input options */
     vlc_mutex_lock( &p_item->lock );
@@ -436,9 +437,11 @@ void input_StopThread( input_thread_t *p_input, bool b_abort )
      * unlock the control loop */
     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 );
-    if( b_abort )
-        input_SendEventAbort( p_input );
 }
 
 input_resource_t *input_DetachResource( input_thread_t *p_input )
@@ -508,7 +511,10 @@ static void *Run( vlc_object_t *p_this )
 
 exit:
     /* Tell we're dead */
+    if( p_input->p->b_abort )
+        input_SendEventAbort( p_input );
     input_SendEventDead( p_input );
+
     vlc_restorecancel( canc );
     return NULL;
 }
index ee3dbd2d88db63a6d641506ae9d5d11aac737c24..8a1366c21943f94477e716ca252b66879b79fcf9 100644 (file)
@@ -165,6 +165,7 @@ struct input_thread_private_t
         int         i_type;
         vlc_value_t val;
     } control[INPUT_CONTROL_FIFO_SIZE];
+    bool b_abort;
 };
 
 /***************************************************************************