diff options
author | Jan Dubois <jand@activestate.com> | 2011-03-15 12:34:10 -0700 |
---|---|---|
committer | Jan Dubois <jand@activestate.com> | 2011-03-15 12:34:10 -0700 |
commit | 3aa0ac5aa5f5cff1b95ae5ff8641818c450e4b16 (patch) | |
tree | 8933a5b8725304e7cd2b212cc93a8b8b52251c8d /win32 | |
parent | c9989a7404d7d04d5a3de35f7783e3fe298e69be (diff) | |
download | perl-3aa0ac5aa5f5cff1b95ae5ff8641818c450e4b16.tar.gz |
Don't wait for SIGTERM'ed forked children on Windows
SIGTERM may never get delivered when a thread/process is blocked in a
system call. To avoid a deadlock Perl will now no longer wait for
children to terminate after they have been signalled with SIGTERM.
Note: this *only* applies to fork() emulation on Windows. Read
pod/perlfork.pod for context on other limitation of this emulation.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c index 2394524853..b8bb5bb5fe 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1310,6 +1310,14 @@ win32_kill(int pid, int sig) if ((hwnd != NULL && PostMessage(hwnd, WM_USER_KILL, sig, 0)) || PostThreadMessage(-pid, WM_USER_KILL, sig, 0)) { + /* Don't wait for child process to terminate after we send a SIGTERM + * because the child may be blocked in a system call and never receive + * the signal. + */ + if (sig == SIGTERM) { + Sleep(0); + remove_dead_pseudo_process(child); + } /* It might be us ... */ PERL_ASYNC_CHECK(); return 0; |