Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^2: hash elements are lost during reaping

by umitd (Initiate)
on Dec 11, 2012 at 11:30 UTC ( #1008275=note: print w/replies, xml ) Need Help??

in reply to Re: hash elements are lost during reaping
in thread hash elements are lost during reaping

Thanks for the reply. My fork routine saves pids of children in another hash to be compared in the processing routine:

sub StartJob { my $pid; my $sid = shift; FORK: { if ($pid = fork) { # # This is the dispatcher! # $JobPIDs{$pid} = $sid; # add pid, sid pair to th +e hash } elsif ($pid == 0) { ....

The processing routine goes like this:

foreach $pid ( keys(%TrappedPIDs) ) { $rc = $TrappedPIDs{$pid}; print " CHECKING: trapped pid: $pid RC: $rc \n"; if ( exists($JobPIDs{$pid}) and $rc == 0 ) { # do the processing .. }
%TrappedPIDs is a global hash. How come it can be different?

Replies are listed 'Best First'.
Re^3: hash elements are lost during reaping
by roboticus (Chancellor) on Dec 11, 2012 at 11:41 UTC


    How come it can be different?

    With you showing only small code fragments, it's rather hard to say. It's kind of like the old joke:

    Goofus is searching for his diamond ring under a streetlamp.

    Gallant comes to help, and after about 15 minutes, he says "Hey--about where were you standing when you lost the ring?".

    Goofus: "Over there in the parking lot."

    Gallant (surprised): "Well, then why are you looking over here?"

    Goofus: "The light is better."


    When your only tool is a hammer, all problems look like your thumb.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1008275]
[Corion]: erix: Sure, but this is for a really-lightweight application and I'm replacing a CSV file / JSON file for user configuration with SQLite (and optionally, Pg) :)
[erix]: isn't a texty format handier for configs?
[Corion]: So far, I've avoided having even a user database by storing the user information in a (signed) cookie that the browser keeps for me, but as I want to be able to lock users, I need a second storage option :)
[Corion]: erix: It's needed for keeping the list of users and the list of tags associated with an image, and for keeping the images with users. I want an easy way to know if an image can be deleted, which means that it can't be referenced by any tag anymore. ...
[Corion]: SQL feels like a natural choice here :)

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (15)
As of 2018-03-20 14:08 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (253 votes). Check out past polls.