]> git.sesse.net Git - vlc/commitdiff
* input.c : Ajout du bool�en b_error et d'une boucle d'erreur pour
authorChristophe Massiot <massiot@videolan.org>
Sat, 2 Oct 1999 10:20:54 +0000 (10:20 +0000)
committerChristophe Massiot <massiot@videolan.org>
Sat, 2 Oct 1999 10:20:54 +0000 (10:20 +0000)
  �viter la fermeture sauvage de l'input ;
* main.c : Le vlc se ferme d�sormais proprement quand il bouffe un SIGINT.

--Meuuh

src/input/input.c
src/interface/main.c

index 073b5c18e3095129056df3a06e2fd378cd8fa433..c66ecc4cd073bae241b8d4aa1773e3a9acec7fae 100644 (file)
@@ -49,6 +49,7 @@
  * Local prototypes
  ******************************************************************************/
 static void input_Thread( input_thread_t *p_input );
+static void ErrorThread( input_thread_t *p_input );
 static void EndThread( input_thread_t *p_input );
 static __inline__ int input_ReadPacket( input_thread_t *p_input );
 static __inline__ void input_SortPacket( input_thread_t *p_input,
@@ -279,14 +280,14 @@ void input_CloseVideoStream( input_thread_t *p_input, int i_id )
 static void input_Thread( input_thread_t *p_input )
 {
     intf_DbgMsg("input debug 11-1: thread %p is active\n", p_input);
-    while( !p_input->b_die )
+    while( !p_input->b_die && !p_input->b_error )
     {
         /* Scatter read the UDP packet from the network or the file. */
         if( (input_ReadPacket( p_input )) == (-1) )
         {
             /* ??? Normally, a thread can't kill itself, but we don't have
              * any method in case of an error condition ... */
-            p_input->b_die = 1;
+            p_input->b_error = 1;
         }
 
 #ifdef STATS
@@ -294,6 +295,11 @@ static void input_Thread( input_thread_t *p_input )
 #endif
     }
 
+    if( p_input->b_error )
+    {
+        ErrorThread( p_input );
+    }
+
     /* Ohoh, we have to die as soon as possible. */
     EndThread( p_input );
 
@@ -301,6 +307,18 @@ static void input_Thread( input_thread_t *p_input )
     pthread_exit( 0 );
 }
 
+
+/******************************************************************************
+ * ErrorThread: RunThread() error loop
+ ******************************************************************************/
+static void ErrorThread( input_thread_t *p_input )
+{
+    while( !p_input->b_die )
+    {
+        msleep( INPUT_IDLE_SLEEP );
+    }
+}
+
 /*******************************************************************************
  * EndThread: end the input thread
  *******************************************************************************/
index 6b56366716244b4e05647dec816fb28e8773f7dd..28665d10c7b19d6d9618caffde40cdac30b59101 100644 (file)
@@ -459,5 +459,5 @@ static void SignalHandler( int i_signal )
 
   /* Try to terminate everything */
   /* ?? this probably needs to be changed */
- /*  p_program_data->intf_thread.b_die = 1; */
+  p_program_data->intf_thread.b_die = 1;
 }