Hello,
I'm doing something like the following:
I run a Perl script which has the following:
# First i install a signal handler for HUP which sets a global flag.
$SIG{"HUP"} = sub { print "HUP received\n"; $received_hup = 1 };
# Now i wait for HUP to be received.
my $cnt = 0;
for ($cnt = 0; $received_hup != 1 and $cnt < 900; $cnt++) {
sleep(1);
}
print ($received_hup == 1) ? "true" : "false";
Then I send HUP to this perl process.
I find that sometimes false is printed although every time "HUP received" is also printed; i.e. although the signal handler is invoked, the global variable is not modified.
I'm not familiar with concurrency issues in Perl, so please guide me with this.