Mercurial > hg > octave-lyh
diff src/sighandlers.cc @ 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 | 5a3f1d00a474 |
line wrap: on
line diff
--- 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++ ***