Mercurial > hg > octave-avbm
changeset 2210:a3e39f8efed2
[project @ 1996-05-15 12:55:55 by jwe]
author | jwe |
---|---|
date | Wed, 15 May 1996 12:56:15 +0000 |
parents | 859030f15706 |
children | 71aef7b5339e |
files | src/pager.cc src/sighandlers.cc |
diffstat | 2 files changed, 45 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pager.cc +++ b/src/pager.cc @@ -80,6 +80,8 @@ static void clear_external_pager (void) { + octave_child_list::remove (octave_pager_pid); + octave_pager_pid = -1; delete external_pager;
--- a/src/sighandlers.cc +++ b/src/sighandlers.cc @@ -77,6 +77,16 @@ #endif } +#if 0 +void +ignore_sigchld (void) +{ +#if defined (SIGCHLD) + octave_set_signal_handler (SIGCHLD, SIG_IGN); +#endif +} +#endif + static void my_friendly_exit (const char *sig_name, int sig_number) { @@ -153,7 +163,7 @@ { int status; - if (waitpid (pid, &status, 0) > 0) + if (waitpid (pid, &status, WNOHANG) > 0) { elt.pid = -1; @@ -454,7 +464,7 @@ for (int i = 0; i < curr_len; i++) { - octave_child tmp = list.elem (i); + octave_child& tmp = list.elem (i); if (tmp.pid < 0) { @@ -493,6 +503,37 @@ panic_impossible (); } +void +octave_child_list::do_remove (pid_t pid) +{ + // Mark the record for PID invalid. + + bool enlarge = true; + + for (int i = 0; i < curr_len; i++) + { + octave_child& tmp = list.elem (i); + + if (tmp.pid == pid) + { + tmp.pid = -1; + break; + } + } +} + +void +octave_child_list::remove (pid_t pid) +{ + if (! instance) + instance = new octave_child_list (); + + if (instance) + instance->do_remove (pid); + else + panic_impossible (); +} + /* ;;; Local Variables: *** ;;; mode: C++ ***