Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Yuval Kogman discovered that sig_child() events were not triggering
after a second POE::Kernel->run() in the same program.  We tracked
this down to a static compile-time initialization.  Moving that into
POE::Resource::Signals::_data_sig_initialize() fixed the problem right
up.
  • Loading branch information
rcaputo committed Jul 5, 2007
1 parent 53f61c6 commit 5f143fe
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/POE/Resource/Signals.pm
Expand Up @@ -62,10 +62,7 @@ use vars (
# A flag to tell whether we're currently polling for signals.
my $polling_for_signals = 0;

# A flag determining whether there are child processes. Starts true
# so our waitpid() loop can run at least once. Starts false when
# running in an Apache handler so our SIGCHLD hijinx don't interfere
# with the web server.
# A flag determining whether there are child processes.
my $kr_child_procs = exists($INC{'Apache.pm'}) ? 0 : 1;

sub _data_sig_preload {
Expand Down Expand Up @@ -105,6 +102,11 @@ my %_safe_signals;
sub _data_sig_initialize {
my $self = shift;

# Initialize this to a true value so our waitpid() loop can run at
# least once. Starts false when running in an Apache handler so our
# SIGCHLD hijinx don't interfere with the web server.
$kr_child_procs = exists($INC{'Apache.pm'}) ? 0 : 1;

# In case we're called multiple times.
unless (keys %_safe_signals) {
foreach my $signal (keys %SIG) {
Expand Down Expand Up @@ -316,10 +318,10 @@ sub _data_sig_pids_ses {

sub _data_sig_pids_is_ses_watching {
my ($self, $session, $pid) = @_;
return(
exists($kr_sessions_to_pids{$session}) &&
exists($kr_sessions_to_pids{$session}{$pid})
);
return(
exists($kr_sessions_to_pids{$session}) &&
exists($kr_sessions_to_pids{$session}{$pid})
);
}

### Return a signal's type, or SIGTYPE_BENIGN if it's not special.
Expand Down

0 comments on commit 5f143fe

Please sign in to comment.