[vlc-devel] commit: input: end immediately, do not wait for kill event ( Rémi Denis-Courmont )

git version control git at videolan.org
Mon Jan 12 21:21:50 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Mon Jan 12 21:27:17 2009 +0200| [640d0d5b6905ef9fe62acc083cf47ae7a3006874] | committer: 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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=640d0d5b6905ef9fe62acc083cf47ae7a3006874
---

 src/input/input.c |   25 ++-----------------------
 1 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index cbd363a..d33b682 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -68,7 +68,6 @@ static  void *RunAndDestroy  ( vlc_object_t *p_this );
 static input_thread_t * Create  ( vlc_object_t *, input_item_t *,
                                   const char *, bool, input_ressource_t * );
 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             MainLoop( input_thread_t *p_input );
 
@@ -517,18 +516,14 @@ static void *Run( vlc_object_t *p_this )
 
     if( Init( p_input ) )
     {
-        /* If we failed, wait before we are killed, and exit */
-        WaitDie( p_input );
+        input_ChangeState( p_input, p_input->b_error ? ERROR_S : END_S );
         goto exit;
     }
 
     MainLoop( p_input );
 
-    /* Wait until we are asked to die */
-    if( !p_input->b_die )
-        WaitDie( p_input );
-
     /* Clean up */
+    input_ChangeState( p_input, p_input->b_error ? ERROR_S : END_S );
     End( p_input );
 
 exit:
@@ -1284,22 +1279,6 @@ error:
 }
 
 /*****************************************************************************
- * 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
  *****************************************************************************/
 static void End( input_thread_t * p_input )




More information about the vlc-devel mailing list