GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
sighandlers.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1993-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 /*
27 
28 The signal blocking macros defined below were adapted from similar
29 functions from GNU Bash, the Bourne Again SHell, copyright (C) 1994
30 Free Software Foundation, Inc.
31 
32 */
33 
34 // This file should always be included after config.h!
35 
36 #if ! defined (octave_sighandlers_h)
37 #define octave_sighandlers_h 1
38 
39 #include "octave-config.h"
40 
41 #include "child-list.h"
42 
43 namespace octave
44 {
45  // This type must match the typedef in signal-wrappers.h.
46  typedef void sig_handler (int);
47 
49  {
52  };
53 
54  // Nonzero means we have already printed a message for this series of
55  // SIGPIPES. We assume that the writer will eventually give up.
56  extern int pipe_handler_error_count;
57 
58  // TRUE means we can be interrupted.
59  extern OCTINTERP_API bool can_interrupt;
60 
61  extern OCTINTERP_API sig_handler *
62  set_signal_handler (int sig, sig_handler *h,
63  bool restart_syscalls = true);
64 
65  extern OCTINTERP_API sig_handler *
66  set_signal_handler (const char *signame, sig_handler *h,
67  bool restart_syscalls = true);
68 
69  extern OCTINTERP_API void install_signal_handlers (void);
70 
71  extern OCTINTERP_API void respond_to_pending_signals (void);
72 
73  extern OCTINTERP_API interrupt_handler catch_interrupts (void);
74 
75  extern OCTINTERP_API interrupt_handler ignore_interrupts (void);
76 
77  extern OCTINTERP_API interrupt_handler
78  set_interrupt_handler (const volatile interrupt_handler& h,
79  bool restart_syscalls = true);
80 
81  // TRUE means we should try to enter the debugger on SIGINT.
82  extern OCTINTERP_API bool Vdebug_on_interrupt;
83 }
84 
85 #endif
sig_handler * set_signal_handler(int sig, sig_handler *handler, bool restart_syscalls)
Definition: sighandlers.cc:255
interrupt_handler set_interrupt_handler(const volatile interrupt_handler &h, bool restart_syscalls)
Definition: sighandlers.cc:344
void respond_to_pending_signals(void)
Definition: sighandlers.cc:106
int pipe_handler_error_count
Definition: sighandlers.cc:65
void sig_handler(int)
Definition: sighandlers.h:46
interrupt_handler ignore_interrupts(void)
Definition: sighandlers.cc:333
bool Vdebug_on_interrupt
Definition: sighandlers.cc:71
bool can_interrupt
Definition: sighandlers.cc:68
interrupt_handler catch_interrupts(void)
Definition: sighandlers.cc:322
void install_signal_handlers(void)
Definition: sighandlers.cc:361
sig_handler * int_handler
Definition: sighandlers.h:50
sig_handler * brk_handler
Definition: sighandlers.h:51