26 Jan 2011 01:56:02 UTC
- Distribution: IPC-SafeFork
- Module version: 0.0100
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (639 / 34 / 9)
- KwaliteeBus factor: 1
- 100.00% Coverage
- License: unknown
- Activity24 month
- Download (32.9KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionGWYN Philip Gwynand 1 contributors
- Philip Gwyn <gwyn at cpan.org>
- SEE ALSO
- COPYRIGHT AND LICENSE
IPC::SafeFork - Safe wrapper around fork
use IPC::SafeFork; my $pid = safe_fork(); use IPC::SafeFork qw( fork ); my $pid = fork();
Fork is not signal safe in perl; due to a race condition a signal could be delivered to both the parent and the child process. This is because in perl, signals set a flag that is verified when it is safe to do so. This flag is not reset in the child.
However, reseting the signal in the child will introduces a new race window; if a signal arrives to the child between the fork and the reset, it will be lost. It would be nice to use sigprocmask(2) to close this window, but that would mess with waitpid().
So it's up to you to decide: do you want more signals to the child (perl built-in) or fewer signals (safe_fork).
Forks the process and resets the signal flags in the child process.
Same as "safe_fork". Not exported by default.
"safe_fork" by default.
"fork" is also available.
This is the perlbug of the problem http://rt.perl.org/rt3//Public/Bug/Display.html?id=82580
Philip Gwyn, <gwyn-at-cpan.org>
Copyright (C) 2011 by Philip Gwyn
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
Module Install Instructions
To install IPC::SafeFork, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install IPC::SafeFork
For more information on module installation, please visit the detailed CPAN module installation guide.