Mercurial > hg > octave-nkf
changeset 11555:f359cfc6e24d
sighandlers.cc: wait for children in octave_signal_handler, not sigchld_handler
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 17 Jan 2011 04:58:42 -0500 |
parents | c139672c9a2f |
children | e582adc89d55 |
files | src/ChangeLog src/sighandlers.cc |
diffstat | 2 files changed, 23 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-01-17 John W. Eaton <jwe@octave.org> + + * sighandlers.cc (octave_signal_handler): Wait for children here. + (sigchld_handler): Not here. + 2011-01-16 Rik <octave@nomad.inbox5.com> * DLD-FUNCTIONS/__delaunayn__.cc, DLD-FUNCTIONS/__dispatch__.cc,
--- a/src/sighandlers.cc +++ b/src/sighandlers.cc @@ -114,7 +114,22 @@ { #ifdef SIGCHLD case SIGCHLD: - octave_child_list::reap (); + { + volatile octave_interrupt_handler saved_interrupt_handler + = octave_ignore_interrupts (); + + sigset_t set, oset; + + BLOCK_CHILD (set, oset); + + octave_child_list::wait (); + + octave_set_interrupt_handler (saved_interrupt_handler); + + UNBLOCK_CHILD (oset); + + octave_child_list::reap (); + } break; #endif @@ -227,25 +242,9 @@ static void sigchld_handler (int /* sig */) { - volatile octave_interrupt_handler saved_interrupt_handler - = octave_ignore_interrupts (); - - sigset_t set, oset; - - BLOCK_CHILD (set, oset); + octave_signal_caught = 1; - if (octave_child_list::wait ()) - { - // The status of some child changed. - - octave_signal_caught = 1; - - octave_signals_caught[SIGCHLD] = true; - } - - octave_set_interrupt_handler (saved_interrupt_handler); - - UNBLOCK_CHILD (oset); + octave_signals_caught[SIGCHLD] = true; } #endif /* defined(SIGCHLD) */