1 // SPDX-License-Identifier: 0BSD
3 ///////////////////////////////////////////////////////////////////////////////
6 /// \brief Handling signals to abort operation
8 // Author: Lasse Collin
10 ///////////////////////////////////////////////////////////////////////////////
12 /// If this is true, we will clean up the possibly incomplete output file,
13 /// return to main() as soon as practical. That is, the code needs to poll
14 /// this variable in various places.
15 extern volatile sig_atomic_t user_abort
;
18 /// Initialize the signal handler, which will set user_abort to true when
19 /// user e.g. presses C-c.
20 extern void signals_init(void);
23 #if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(__VMS)
24 # define signals_block() do { } while (0)
25 # define signals_unblock() do { } while (0)
27 /// Block the signals which don't have SA_RESTART and which would just set
28 /// user_abort to true. This is handy when we don't want to handle EINTR
29 /// and don't want SA_RESTART either.
30 extern void signals_block(void);
32 /// Unblock the signals blocked by signals_block().
33 extern void signals_unblock(void);
36 #if defined(_WIN32) && !defined(__CYGWIN__)
37 # define signals_exit() do { } while (0)
39 /// If user has sent us a signal earlier to terminate the process,
40 /// re-raise that signal to actually terminate the process.
41 extern void signals_exit(void);