change to automatic reaping of zombie processes started by 'subprocess'

svn: r15520
This commit is contained in:
Matthew Flatt 2009-07-21 16:23:05 +00:00
parent 4384eb741c
commit a68e353b99
4 changed files with 18 additions and 5 deletions

View File

@ -73,11 +73,7 @@ The @scheme[subprocess] procedure returns four values:
@bold{Important:} All ports returned from @scheme[subprocess] must be
explicitly closed with @scheme[close-input-port] or
@scheme[close-output-port]. Similarly, waiting on the subprocess value
(using @scheme[subprocess-wait] or @scheme[sync]) ensures that the
operating system can release the subprocess; for example,
exiting without waiting on a subprocess under Unix risks leaving the
subprocess as a zombie.
@scheme[close-output-port].
The returned ports are @tech{file-stream ports} (see
@secref["file-ports"]), and they are placed into the management of

View File

@ -6814,6 +6814,8 @@ static int MyPipe(int *ph, int near_index) {
# define GC_write_barrier(x) /* empty */
#endif
static int need_to_check_children;
#ifdef MZ_XFORM
START_XFORM_SKIP;
#endif
@ -6832,6 +6834,7 @@ void scheme_block_child_signals(int block)
static void child_done(int ingored)
{
need_to_check_children = 1;
scheme_signal_received();
# ifdef SIGSET_NEEDS_REINSTALL
@ -6896,6 +6899,14 @@ static void check_child_done()
}
}
void scheme_check_child_done(void)
{
if (need_to_check_children) {
need_to_check_children = 0;
check_child_done();
}
}
#endif
/*========================================================================*/

View File

@ -414,6 +414,7 @@ void scheme_start_itimer_thread(long usec);
#ifdef UNIX_PROCESSES
void scheme_block_child_signals(int block);
void scheme_check_child_done(void);
#endif
Scheme_Object **scheme_alloc_runstack(long len);

View File

@ -4088,6 +4088,11 @@ void scheme_thread_block(float sleep_time)
/* Check scheduled_kills early and often. */
check_scheduled_kills();
#ifdef UNIX_PROCESSES
/* Reap zombie processes: */
scheme_check_child_done();
#endif
shrink_cust_box_array();
if (scheme_active_but_sleeping)