places: re-enable (and re-ignore) SIGCHLD in a fork()ed process

Relevant to PR 11877
This commit is contained in:
Matthew Flatt 2011-04-26 11:11:22 -06:00
parent f5de8bdabf
commit 604960f5f5
3 changed files with 15 additions and 0 deletions

View File

@ -592,6 +592,17 @@ void scheme_places_block_child_signal() XFORM_SKIP_PROC
MZ_SIGSET(SIGCHLD, got_sigchld);
}
void scheme_places_unblock_child_signal() XFORM_SKIP_PROC
{
sigset_t set;
MZ_SIGSET(SIGCHLD, SIG_IGN);
sigemptyset(&set);
sigaddset(&set, SIGCHLD);
sigprocmask(SIG_UNBLOCK, &set, NULL);
}
void scheme_places_start_child_signal_handler()
{
mz_proc_thread *signal_thread;

View File

@ -8106,6 +8106,9 @@ static Scheme_Object *subprocess(int c, Scheme_Object *args[])
#if !defined(MZ_PLACES_WAITPID)
scheme_block_child_signals(0);
#else
if (!pid)
scheme_places_unblock_child_signal();
#endif
}

View File

@ -3631,6 +3631,7 @@ Scheme_Object *scheme_places_deep_copy(Scheme_Object *so);
# ifdef UNIX_PROCESSES
# define MZ_PLACES_WAITPID
void scheme_places_block_child_signal();
void scheme_places_unblock_child_signal();
void scheme_places_start_child_signal_handler();
int scheme_get_child_status(int pid, int is_group, int *status);
int scheme_places_register_child(int pid, int is_group, void *signal_fd, int *status);