src/xz/signals.c File Reference

Handling signals to abort operation. More...

#include "private.h"

Functions

static void signal_handler (int sig)
void signals_init (void)
void signals_block (void)
void signals_unblock (void)
 Unblock the signals blocked by signals_block().
void signals_exit (void)

Variables

volatile sig_atomic_t user_abort = false
static volatile sig_atomic_t exit_signal = 0
static sigset_t hooked_signals
static size_t signals_block_count = 0
 signals_block() and signals_unblock() can be called recursively.


Detailed Description

Handling signals to abort operation.


Function Documentation

void signals_init ( void   ) 

Initialize the signal handler, which will set user_abort to true when user e.g. presses C-c.

References hooked_signals, and message_signal_handler().

void signals_block ( void   ) 

Block the signals which don't have SA_RESTART and which would just set user_abort to true. This is handy when we don't want to handle EINTR and don't want SA_RESTART either.

References hooked_signals, and signals_block_count.

Referenced by io_close(), io_open(), io_open_src(), message_progress_end(), and print_filename().

void signals_unblock ( void   ) 

Unblock the signals blocked by signals_block().

References hooked_signals, and signals_block_count.

Referenced by io_close(), io_open(), io_open_src(), message_progress_end(), and print_filename().

void signals_exit ( void   ) 

If user has sent us a signal earlier to terminate the process, re-raise that signal to actually terminate the process.

References exit_signal.

Referenced by my_exit().


Variable Documentation

volatile sig_atomic_t user_abort = false

If this is true, we will clean up the possibly incomplete output file, return to main() as soon as practical. That is, the code needs to poll this variable in various places.

Referenced by io_open(), io_open_src(), io_read(), io_write(), and message_progress_end().

volatile sig_atomic_t exit_signal = 0 [static]

If we were interrupted by a signal, we store the signal number so that we can raise that signal to kill the program when all cleanups have been done.

Referenced by signals_exit().

sigset_t hooked_signals [static]

Mask of signals for which have have established a signal handler to set user_abort to true.

Referenced by signals_block(), signals_init(), and signals_unblock().

size_t signals_block_count = 0 [static]

signals_block() and signals_unblock() can be called recursively.

Referenced by signals_block(), and signals_unblock().


Generated on Wed May 25 10:35:47 2011 for XZ Utils by  doxygen 1.5.5