annotate src/sighandlers.h @ 14846:460a3c6d8bf1

maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists. Example: func() => func () * dynamic.txi, func.txi, oop.txi, var.txi, embedded.cc, fortdemo.cc, funcdemo.cc, paramdemo.cc, stringdemo.cc, unwinddemo.cc, Array.cc, Array.h, CColVector.cc, CDiagMatrix.h, CMatrix.cc, CNDArray.cc, CRowVector.cc, CSparse.cc, CmplxGEPBAL.cc, EIG.cc, MSparse.cc, MatrixType.cc, Sparse-op-defs.h, Sparse-perm-op-defs.h, Sparse.cc, Sparse.h, SparseCmplxCHOL.cc, SparseCmplxCHOL.h, SparseCmplxLU.cc, SparseCmplxQR.cc, SparseCmplxQR.h, SparseQR.cc, SparseQR.h, SparsedbleCHOL.cc, SparsedbleCHOL.h, SparsedbleLU.cc, SparsedbleLU.h, base-lu.cc, cmd-hist.cc, dColVector.cc, dDiagMatrix.h, dMatrix.cc, dNDArray.cc, dRowVector.cc, dSparse.cc, dbleCHOL.cc, dbleGEPBAL.cc, dim-vector.cc, eigs-base.cc, f2c-main.c, fCColVector.cc, fCDiagMatrix.h, fCMatrix.cc, fCNDArray.cc, fCRowVector.cc, fCmplxGEPBAL.cc, fColVector.cc, fDiagMatrix.h, fEIG.cc, fMatrix.cc, fNDArray.cc, fRowVector.cc, file-ops.cc, file-stat.cc, floatCHOL.cc, floatGEPBAL.cc, idx-vector.h, lo-specfun.cc, lo-sysdep.cc, mx-inlines.cc, oct-binmap.h, oct-convn.cc, oct-md5.cc, oct-mem.h, oct-rand.cc, oct-syscalls.cc, randgamma.c, randmtzig.c, sparse-base-chol.cc, sparse-base-chol.h, sparse-base-lu.cc, sparse-dmsolve.cc, tempname.c, curl.m, divergence.m, randi.m, dlmwrite.m, edit.m, getappdata.m, what.m, getarchdir.m, install.m, installed_packages.m, repackage.m, unload_packages.m, colorbar.m, figure.m, isosurface.m, legend.m, loglog.m, plot.m, plot3.m, plotyy.m, polar.m, __errplot__.m, __ghostscript__.m, __marching_cube__.m, __plt__.m, __scatter__.m, semilogx.m, semilogy.m, trimesh.m, trisurf.m, demo.m, test.m, datetick.m, __delaunayn__.cc, __dsearchn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __lin_interpn__.cc, __magick_read__.cc, __pchip_deriv__.cc, balance.cc, bsxfun.cc, ccolamd.cc, cellfun.cc, chol.cc, daspk.cc, dasrt.cc, dassl.cc, dmperm.cc, eig.cc, eigs.cc, fftw.cc, filter.cc, find.cc, kron.cc, lookup.cc, lsode.cc, matrix_type.cc, md5sum.cc, mgorth.cc, qr.cc, quad.cc, rand.cc, regexp.cc, symbfact.cc, tril.cc, urlwrite.cc, op-bm-bm.cc, op-cdm-cdm.cc, op-cell.cc, op-chm.cc, op-cm-cm.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc, op-fdm-fdm.cc, op-fm-fm.cc, op-int.h, op-m-m.cc, op-m-scm.cc, op-m-sm.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-range.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-str.cc, op-struct.cc, bitfcns.cc, data.cc, debug.cc, dynamic-ld.cc, error.cc, gl-render.cc, graphics.cc, graphics.in.h, load-path.cc, ls-hdf5.cc, ls-mat5.cc, ls-mat5.h, ls-oct-ascii.cc, ls-oct-ascii.h, mex.cc, mk-errno-list, oct-map.cc, oct-obj.h, oct-parse.yy, octave-config.in.cc, ov-base-int.cc, ov-base-mat.cc, ov-base.cc, ov-bool-mat.cc, ov-bool-sparse.cc, ov-bool.cc, ov-cell.cc, ov-class.cc, ov-class.h, ov-cx-mat.cc, ov-cx-sparse.cc, ov-fcn-handle.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-intx.h, ov-range.h, ov-re-mat.cc, ov-re-sparse.cc, ov-str-mat.cc, ov-struct.cc, ov-usr-fcn.h, ov.h, pr-output.cc, pt-id.cc, pt-id.h, pt-mat.cc, pt-select.cc, sparse.cc, symtab.cc, symtab.h, syscalls.cc, toplev.cc, txt-eng-ft.cc, variables.cc, zfstream.cc, zfstream.h, Dork.m, getStash.m, myStash.m, Gork.m, Pork.m, myStash.m, getStash.m, myStash.m, getStash.m, myStash.m, fntests.m: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
author Rik <octave@nomad.inbox5.com>
date Sun, 08 Jul 2012 11:28:50 -0700
parents 72c96de7a403
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
1 /*
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
2
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 13983
diff changeset
3 Copyright (C) 1993-2012 John W. Eaton
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
4
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
6
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6972
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6972
diff changeset
10 option) any later version.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
11
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
15 for more details.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
16
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6972
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6972
diff changeset
19 <http://www.gnu.org/licenses/>.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
20
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
21 */
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
22
2939
f2feebf0eb7d [project @ 1997-05-06 16:36:34 by jwe]
jwe
parents: 2926
diff changeset
23 /*
f2feebf0eb7d [project @ 1997-05-06 16:36:34 by jwe]
jwe
parents: 2926
diff changeset
24
f2feebf0eb7d [project @ 1997-05-06 16:36:34 by jwe]
jwe
parents: 2926
diff changeset
25 The signal blocking macros defined below were adapted from similar
f2feebf0eb7d [project @ 1997-05-06 16:36:34 by jwe]
jwe
parents: 2926
diff changeset
26 functions from GNU Bash, the Bourne Again SHell, copyright (C) 1994
f2feebf0eb7d [project @ 1997-05-06 16:36:34 by jwe]
jwe
parents: 2926
diff changeset
27 Free Software Foundation, Inc.
f2feebf0eb7d [project @ 1997-05-06 16:36:34 by jwe]
jwe
parents: 2926
diff changeset
28
f2feebf0eb7d [project @ 1997-05-06 16:36:34 by jwe]
jwe
parents: 2926
diff changeset
29 */
f2feebf0eb7d [project @ 1997-05-06 16:36:34 by jwe]
jwe
parents: 2926
diff changeset
30
834
44ce29d8cb7b [project @ 1994-10-19 18:17:44 by jwe]
jwe
parents: 383
diff changeset
31 // This file should always be included after config.h!
44ce29d8cb7b [project @ 1994-10-19 18:17:44 by jwe]
jwe
parents: 383
diff changeset
32
383
0b52c68ec81f [project @ 1994-03-09 21:19:44 by jwe]
jwe
parents: 296
diff changeset
33 #if !defined (octave_sighandlers_h)
0b52c68ec81f [project @ 1994-03-09 21:19:44 by jwe]
jwe
parents: 296
diff changeset
34 #define octave_sighandlers_h 1
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
35
3566
4b1a93f83264 [project @ 2000-02-03 09:19:49 by jwe]
jwe
parents: 3546
diff changeset
36 // Include signal.h, not csignal since the latter might only define
4b1a93f83264 [project @ 2000-02-03 09:19:49 by jwe]
jwe
parents: 3546
diff changeset
37 // the ANSI standard C signal interface.
4b1a93f83264 [project @ 2000-02-03 09:19:49 by jwe]
jwe
parents: 3546
diff changeset
38
4b1a93f83264 [project @ 2000-02-03 09:19:49 by jwe]
jwe
parents: 3546
diff changeset
39 #include <signal.h>
2209
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
40
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
41 #include "syswait.h"
3546
6dfdded73a7e [project @ 2000-02-02 22:45:39 by jwe]
jwe
parents: 3018
diff changeset
42 #include "siglist.h"
2209
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
43
5142
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
44 #include "base-list.h"
3566
4b1a93f83264 [project @ 2000-02-03 09:19:49 by jwe]
jwe
parents: 3546
diff changeset
45
10246
f751dae7aab8 use gnulib signal modules
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
46 typedef void sig_handler (int);
290
5325afdb0ef5 [project @ 1994-01-13 19:21:40 by jwe]
jwe
parents: 240
diff changeset
47
5775
ace8d8d26933 [project @ 2006-04-24 19:13:06 by jwe]
jwe
parents: 5770
diff changeset
48 // FIXME -- the data should probably be private...
2554
f7e3d23f0a8f [project @ 1996-11-21 01:41:57 by jwe]
jwe
parents: 2469
diff changeset
49
2705
18395aaeafb7 [project @ 1997-02-20 04:56:43 by jwe]
jwe
parents: 2693
diff changeset
50 struct
18395aaeafb7 [project @ 1997-02-20 04:56:43 by jwe]
jwe
parents: 2693
diff changeset
51 octave_interrupt_handler
18395aaeafb7 [project @ 1997-02-20 04:56:43 by jwe]
jwe
parents: 2693
diff changeset
52 {
18395aaeafb7 [project @ 1997-02-20 04:56:43 by jwe]
jwe
parents: 2693
diff changeset
53 #ifdef SIGINT
18395aaeafb7 [project @ 1997-02-20 04:56:43 by jwe]
jwe
parents: 2693
diff changeset
54 sig_handler *int_handler;
18395aaeafb7 [project @ 1997-02-20 04:56:43 by jwe]
jwe
parents: 2693
diff changeset
55 #endif
18395aaeafb7 [project @ 1997-02-20 04:56:43 by jwe]
jwe
parents: 2693
diff changeset
56
18395aaeafb7 [project @ 1997-02-20 04:56:43 by jwe]
jwe
parents: 2693
diff changeset
57 #ifdef SIGBREAK
18395aaeafb7 [project @ 1997-02-20 04:56:43 by jwe]
jwe
parents: 2693
diff changeset
58 sig_handler *brk_handler;
18395aaeafb7 [project @ 1997-02-20 04:56:43 by jwe]
jwe
parents: 2693
diff changeset
59 #endif
18395aaeafb7 [project @ 1997-02-20 04:56:43 by jwe]
jwe
parents: 2693
diff changeset
60 };
2554
f7e3d23f0a8f [project @ 1996-11-21 01:41:57 by jwe]
jwe
parents: 2469
diff changeset
61
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
62 // Nonzero means we have already printed a message for this series of
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
63 // SIGPIPES. We assume that the writer will eventually give up.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
64 extern int pipe_handler_error_count;
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
65
3018
5708b8bb4f06 [project @ 1997-06-03 21:48:05 by jwe]
jwe
parents: 2939
diff changeset
66 // TRUE means we can be interrupted.
6972
b5a6f5c71451 [project @ 2007-10-08 09:36:57 by jwe]
jwe
parents: 6109
diff changeset
67 extern OCTINTERP_API bool can_interrupt;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
68
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5775
diff changeset
69 extern OCTINTERP_API sig_handler *octave_set_signal_handler (int, sig_handler *,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10246
diff changeset
70 bool restart_syscalls = true);
1443
cd6c9be7337c [project @ 1995-09-19 21:54:56 by jwe]
jwe
parents: 1315
diff changeset
71
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5775
diff changeset
72 extern OCTINTERP_API void install_signal_handlers (void);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
73
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5775
diff changeset
74 extern OCTINTERP_API void octave_signal_handler (void);
5142
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
75
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5775
diff changeset
76 extern OCTINTERP_API octave_interrupt_handler octave_catch_interrupts (void);
2554
f7e3d23f0a8f [project @ 1996-11-21 01:41:57 by jwe]
jwe
parents: 2469
diff changeset
77
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5775
diff changeset
78 extern OCTINTERP_API octave_interrupt_handler octave_ignore_interrupts (void);
2554
f7e3d23f0a8f [project @ 1996-11-21 01:41:57 by jwe]
jwe
parents: 2469
diff changeset
79
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5775
diff changeset
80 extern OCTINTERP_API octave_interrupt_handler
5770
6a9244f89a2a [project @ 2006-04-18 17:44:33 by jwe]
jwe
parents: 5307
diff changeset
81 octave_set_interrupt_handler (const volatile octave_interrupt_handler&,
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10246
diff changeset
82 bool restart_syscalls = true);
1651
e846e361a265 [project @ 1995-12-20 06:59:12 by jwe]
jwe
parents: 1445
diff changeset
83
2214
b5c7309168f3 [project @ 1996-05-16 15:48:22 by jwe]
jwe
parents: 2209
diff changeset
84 // extern void ignore_sigchld (void);
b5c7309168f3 [project @ 1996-05-16 15:48:22 by jwe]
jwe
parents: 2209
diff changeset
85
2209
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
86 // Maybe this should be in a separate file?
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
87
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
88 class
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5775
diff changeset
89 OCTINTERP_API
2209
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
90 octave_child
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
91 {
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
92 public:
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11525
diff changeset
93
5142
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
94 // Do whatever to handle event for child with PID (might not
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
95 // actually be dead, could just be stopped). Return true if
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
96 // the list element corresponding to PID should be removed from
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
97 // list. This function should not call any functions that modify
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
98 // the octave_child_list.
2209
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
99
5142
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
100 typedef bool (*child_event_handler) (pid_t, int);
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
101
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
102 octave_child (pid_t id = -1, child_event_handler f = 0)
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
103 : pid (id), handler (f), have_status (0), status (0) { }
2209
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
104
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
105 octave_child (const octave_child& oc)
5142
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
106 : pid (oc.pid), handler (oc.handler),
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
107 have_status (oc.have_status), status (oc.status) { }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11525
diff changeset
108
2209
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
109 octave_child& operator = (const octave_child& oc)
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
110 {
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
111 if (&oc != this)
10313
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10246
diff changeset
112 {
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10246
diff changeset
113 pid = oc.pid;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10246
diff changeset
114 handler = oc.handler;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10246
diff changeset
115 have_status = oc.have_status;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10246
diff changeset
116 status = oc.status;
f3b65e1ae355 untabify src header files
John W. Eaton <jwe@octave.org>
parents: 10246
diff changeset
117 }
2209
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
118 return *this;
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
119 }
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
120
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
121 ~octave_child (void) { }
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
122
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
123 // The process id of this child.
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
124 pid_t pid;
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
125
5142
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
126 // The function we call if an event happens for this child.
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
127 child_event_handler handler;
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
128
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
129 // Nonzero if this child has stopped or terminated.
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
130 sig_atomic_t have_status;
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
131
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
132 // The status of this child; 0 if running, otherwise a status value
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
133 // from waitpid.
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
134 int status;
2209
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
135 };
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
136
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
137 class
6109
c68896f193e3 [project @ 2006-10-27 02:16:18 by jwe]
jwe
parents: 5775
diff changeset
138 OCTINTERP_API
2209
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
139 octave_child_list
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
140 {
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
141 protected:
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
142
5142
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
143 octave_child_list (void) { }
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
144
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
145 class octave_child_list_rep : public octave_base_list<octave_child>
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
146 {
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
147 public:
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
148
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
149 void insert (pid_t pid, octave_child::child_event_handler f);
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
150
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
151 void reap (void);
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
152
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
153 bool wait (void);
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
154 };
2209
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
155
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
156 public:
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
157
5142
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
158 ~octave_child_list (void) { }
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
159
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
160 static void insert (pid_t pid, octave_child::child_event_handler f);
2209
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
161
5142
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
162 static void reap (void);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents: 2847
diff changeset
163
5142
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
164 static bool wait (void);
2209
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
165
2214
b5c7309168f3 [project @ 1996-05-16 15:48:22 by jwe]
jwe
parents: 2209
diff changeset
166 static void remove (pid_t pid);
b5c7309168f3 [project @ 1996-05-16 15:48:22 by jwe]
jwe
parents: 2209
diff changeset
167
2209
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
168 private:
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
169
5142
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
170 static bool instance_ok (void);
2209
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
171
5142
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 5128
diff changeset
172 static octave_child_list_rep *instance;
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
173
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
174 static void cleanup_instance (void) { delete instance; instance = 0; }
2209
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
175 };
859030f15706 [project @ 1996-05-15 11:46:43 by jwe]
jwe
parents: 2016
diff changeset
176
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
177 #endif