This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
If kill 0, PPID works, use it to avoid race conditions in t/op/getppid.t
authorNicholas Clark <nick@ccl4.org>
Fri, 1 Jun 2012 15:45:12 +0000 (17:45 +0200)
committerNicholas Clark <nick@ccl4.org>
Sat, 2 Jun 2012 10:39:13 +0000 (12:39 +0200)
commite5325a77d878b331cfad4b528f616e0d62b6b5a7
tree4c6a6e6c0d0a7797dabab162b26bc205f9b73c54
parent7285a48a38e9b0d329d9f45cdbca473adedc9c1e
If kill 0, PPID works, use it to avoid race conditions in t/op/getppid.t

POSIX allows one to use kill 0, PPID to detect if a process exists.
(Strictly that the current process is permitted to signal it, which is the
case here). If the system is sufficiently POSIXy, use kill 0, PPID to detect
that the parent has terminated, instead of just sleeping and hoping for the
best.

(Strictly to ensure the test terminates, there is still a race condition,
but if your test system is so loaded that a process takes more than 10
seconds to terminate, you've likely got bigger problems you need to address
first.)
t/op/getppid.t