Reminds me of a resource
serialization problem I had back in the old uni days, where I had to synchronize data between parent/children.
One of the solutions was to use an
external database, where database I/O's were handled by an independent (external) process.
Another solution was to use shared memory (I was coding it in C then). I think it must be
our liz who has posted this module on CPAN (well done
liz) -
forks::shared. It states that:
The "forks::shared" pragma allows a developer to use shared variables with threads (implemented with the "forks" pragma) without having to have a threaded perl, or to even run 5.8.0 or higher.
And example pulled from CPAN -
use forks;
use forks::shared;
my $variable : shared;
my @array : shared;
my %hash : shared;
share( $variable );
share( @array );
share( %hash );
lock( $variable );
cond_wait( $variable );
cond_signal( $variable );
cond_broadcast( $variable );
Take a look at this module, I think this might be a more elegant solution to your problem.