Browse Source

* 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
pull/2/head
Christophe Massiot 27 years ago
parent
commit
b0539b3748
  1. 22
      src/input/input.c
  2. 2
      src/interface/main.c

22
src/input/input.c

@ -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
*******************************************************************************/

2
src/interface/main.c

@ -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;
}

Loading…
Cancel
Save