GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sighandlers.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1993-2024 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 <atomic>
40 
41 #include "octave-config.h"
42 
43 #include "child-list.h"
44 
46 
47 // This type must match the typedef in signal-wrappers.h.
48 typedef void sig_handler (int);
49 
51 {
54 };
55 
56 // Nonzero means we have already printed a message for this series of
57 // SIGPIPES. We assume that the writer will eventually give up.
58 extern int pipe_handler_error_count;
59 
60 // TRUE means we can be interrupted.
61 extern OCTINTERP_API std::atomic<bool> can_interrupt;
62 
63 extern OCTINTERP_API sig_handler *
64 set_signal_handler (int sig, sig_handler *h,
65  bool restart_syscalls = true);
66 
67 extern OCTINTERP_API sig_handler *
68 set_signal_handler (const char *signame, sig_handler *h,
69  bool restart_syscalls = true);
70 
71 extern OCTINTERP_API void install_signal_handlers ();
72 
73 extern OCTINTERP_API void respond_to_pending_signals ();
74 
75 extern OCTINTERP_API interrupt_handler catch_interrupts ();
76 
77 extern OCTINTERP_API interrupt_handler ignore_interrupts ();
78 
79 extern OCTINTERP_API interrupt_handler
80 set_interrupt_handler (const volatile interrupt_handler& h,
81  bool restart_syscalls = true);
82 
83 // TRUE means we should try to enter the debugger on SIGINT.
84 extern OCTINTERP_API bool Vdebug_on_interrupt;
85 
86 OCTAVE_END_NAMESPACE(octave)
87 
88 #endif
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
interrupt_handler ignore_interrupts()
Definition: sighandlers.cc:338
void respond_to_pending_signals()
Definition: sighandlers.cc:111
bool Vdebug_on_interrupt
Definition: sighandlers.cc:72
int pipe_handler_error_count
Definition: sighandlers.cc:66
void sig_handler(int)
Definition: sighandlers.h:48
interrupt_handler set_interrupt_handler(const volatile interrupt_handler &h, bool restart_syscalls=true)
Definition: sighandlers.cc:349
std::atomic< bool > can_interrupt
Definition: sighandlers.cc:69
interrupt_handler catch_interrupts()
Definition: sighandlers.cc:327
void install_signal_handlers()
Definition: sighandlers.cc:366
sig_handler * set_signal_handler(int sig, sig_handler *h, bool restart_syscalls=true)
Definition: sighandlers.cc:260
sig_handler * int_handler
Definition: sighandlers.h:52
sig_handler * brk_handler
Definition: sighandlers.h:53