Commit b0539b37 authored by Christophe Massiot's avatar Christophe Massiot

* input.c : Ajout du bool�en b_error et d'une boucle d'erreur pour

  �viter la fermeture sauvage de l'input ;
* main.c : Le vlc se ferme d�sormais proprement quand il bouffe un SIGINT.

--Meuuh
parent ab846e64
......@@ -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
*******************************************************************************/
......
......@@ -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;
}
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