Re: how to share variable across multi-processes
- From: chas.owens@xxxxxxxxx (Chas Owens)
- Date: Mon, 30 Jan 2006 01:47:55 -0500
On 1/30/06, Jeff Pang <pangj@xxxxxxxxxxxxx> wrote:
> hello,lists,
>
> I have a hash var in my script,and I want to get it be shared across multi-processes.Fox example:
>
> my %hash;
>
> while(1)
> {
> die "can't fork:$!" unless defined (my $child = fork());
>
> if ($child==0)
> {
> do_something_to_hash(); # here I need to do some operations to the %hash,which is defined globally.These operations include add something to %hash,or do modification or 'delete' to %hash.
> }
> }
>
> Is there any suggestion or document can help me to do that?thanks.
snip
You might consider using a dbm to store the hash in the file system.
Look at dbmopen and DBM::Any.
.
- References:
- how to share variable across multi-processes
- From: Jeff Pang
- how to share variable across multi-processes
- Prev by Date: how to share variable across multi-processes
- Next by Date: Re: Learning Perl - the Good and the Bad (Tutorials, Habits, and Tools, etc)
- Previous by thread: how to share variable across multi-processes
- Next by thread: Re: how to share variable across multi-processes
- Index(es):
Relevant Pages
|
|