-
-#ifndef WIN32
-/*****************************************************************************
- * SigHandler: system signal handler
- *****************************************************************************
- * This function is called when a fatal signal is received by the program.
- * It tries to end the program in a clean way.
- *****************************************************************************/
-static void SigHandler( int i_signal )
-{
- static time_t abort_time = 0;
- static volatile vlc_bool_t b_die = VLC_FALSE;
-
- /* Once a signal has been trapped, the termination sequence will be
- * armed and subsequent signals will be ignored to avoid sending signals
- * to a libvlc structure having been destroyed */
-
- if( !b_die )
- {
- b_die = VLC_TRUE;
- abort_time = time( NULL );
-
- fprintf( stderr, "signal %d received, terminating vlc - do it "
- "again in case it gets stuck\n", i_signal );
-
- /* Acknowledge the signal received */
- VLC_Die( 0 );
- }
- else if( time( NULL ) > abort_time + 2 )
- {
- /* If user asks again 1 or 2 seconds later, die badly */
- signal( SIGINT, SIG_DFL );
- signal( SIGHUP, SIG_DFL );
- signal( SIGQUIT, SIG_DFL );
- signal( SIGALRM, SIG_DFL );
- signal( SIGPIPE, SIG_DFL );
-
- fprintf( stderr, "user insisted too much, dying badly\n" );
-
- abort();
- }
-}
-#endif
-