GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
sighandlers.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1993-2017 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 /*
24 
25 The signal blocking macros defined below were adapted from similar
26 functions from GNU Bash, the Bourne Again SHell, copyright (C) 1994
27 Free Software Foundation, Inc.
28 
29 */
30 
31 // This file should always be included after config.h!
32 
33 #if ! defined (octave_sighandlers_h)
34 #define octave_sighandlers_h 1
35 
36 #include "octave-config.h"
37 
38 #include "child-list.h"
39 
40 namespace octave
41 {
42  // This type must match the typedef in signal-wrappers.h.
43  typedef void sig_handler (int);
44 
45  struct
47  {
50  };
51 
52  // Nonzero means we have already printed a message for this series of
53  // SIGPIPES. We assume that the writer will eventually give up.
54  extern int pipe_handler_error_count;
55 
56  // TRUE means we can be interrupted.
57  extern OCTINTERP_API bool can_interrupt;
58 
59  extern OCTINTERP_API sig_handler *
60  set_signal_handler (int sig, sig_handler *h,
61  bool restart_syscalls = true);
62 
63  extern OCTINTERP_API sig_handler *
64  set_signal_handler (const char *signame, sig_handler *h,
65  bool restart_syscalls = true);
66 
67  extern OCTINTERP_API void install_signal_handlers (void);
68 
69  extern OCTINTERP_API void signal_handler (void);
70 
72 
74 
76  set_interrupt_handler (const volatile interrupt_handler& h,
77  bool restart_syscalls = true);
78 
79  // TRUE means we should try to enter the debugger on SIGINT.
81 }
82 
83 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS)
84 
85 OCTAVE_DEPRECATED ("use 'octave::interrupt_handler' instead")
86 typedef octave::interrupt_handler octave_interrupt_handler;
87 
88 OCTAVE_DEPRECATED ("use 'octave::sig_handler' instead")
90 
91 OCTAVE_DEPRECATED ("use 'octave::pipe_handler_error_count' instead")
93 
94 OCTAVE_DEPRECATED ("use 'octave::can_interrupt' instead")
95 static auto& can_interrupt = octave::can_interrupt;
96 
97 OCTAVE_DEPRECATED ("use 'octave::set_signal_handler' instead")
98 inline octave::sig_handler *
99 octave_set_signal_handler (int sig, octave::sig_handler *handler,
100  bool restart_syscalls = true)
101 {
102  return octave::set_signal_handler (sig, handler, restart_syscalls);
103 }
104 
105 OCTAVE_DEPRECATED ("use 'octave::set_signal_handler' instead")
106 inline octave::sig_handler *
107 octave_set_signal_handler (const char *signame, octave::sig_handler *handler,
108  bool restart_syscalls = true)
109 {
110  return octave::set_signal_handler (signame, handler, restart_syscalls);
111 }
112 
113 OCTAVE_DEPRECATED ("use 'octave::set_signal_handler' instead")
115 
116 OCTAVE_DEPRECATED ("use 'octave::signal_handler' instead")
117 const auto octave_signal_handler = octave::signal_handler;
118 
119 OCTAVE_DEPRECATED ("use 'octave::interrupt_handler' instead")
120 const auto octave_catch_interrupts = octave::catch_interrupts;
121 
122 OCTAVE_DEPRECATED ("use 'octave::ignore_interrupts' instead")
123 const auto octave_ignore_interrupts = octave::ignore_interrupts;
124 
125 OCTAVE_DEPRECATED ("use 'octave::set_interrupt_handler' instead")
126 const auto octave_set_interrupt_handler = octave::set_interrupt_handler;
127 
128 OCTAVE_DEPRECATED ("use 'octave::Vdebug_on_interrupt' instead")
130 
131 #endif
132 
133 #endif
Octave interface to the compression and uncompression libraries.
Definition: aepbalance.cc:47
interrupt_handler catch_interrupts(void)
Definition: sighandlers.cc:559
void sig_handler(int)
Definition: sighandlers.h:43
void octave_sig_handler(int)
bool can_interrupt
Definition: sighandlers.cc:67
sig_handler * set_signal_handler(int sig, sig_handler *handler, bool restart_syscalls)
Definition: sighandlers.cc:406
double h
Definition: graphics.cc:11205
bool Vdebug_on_interrupt
Definition: sighandlers.cc:70
#define OCTINTERP_API
Definition: mexproto.h:69
int pipe_handler_error_count
Definition: sighandlers.cc:64
sig_handler * brk_handler
Definition: sighandlers.h:49
void signal_handler(void)
Definition: sighandlers.cc:321
sig_handler * int_handler
Definition: sighandlers.h:48
interrupt_handler ignore_interrupts(void)
Definition: sighandlers.cc:572
interrupt_handler set_interrupt_handler(const volatile interrupt_handler &h, bool restart_syscalls)
Definition: sighandlers.cc:585
void install_signal_handlers(void)
Definition: sighandlers.cc:604