in reply to Re: IPC and communication between Parent and Child Process
in thread IPC and communication between Parent and Child Process
thanks for the reply, field supposed to holds the latest value in share memory, $newvalue.
what confused me is that when child process is dead, parent will fork a new one, at that time I do see field of the object in parent holds the latest value of $newvalue since this section get executed:
so I expect the forked new child should also have that value.from my understanding of the fork, it will get a copy of the parent's var, filehandle,etc. right ? However, new child does not get the lastest $newvalue but get the value when parent first startup (parent never exit since this is a daemon which monitors child). so did I misunderstand the meaning of fork or something else ? btw, in the child section, I removed the tie $newvalue... so that $newvalue will always be the one in share memory.if ($pid = fork) { #parent $this->{'field'} = $newvalue; $num_children++; print 'parent'.$$.'|'.$this->{'field'}."\n"; return; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: IPC and communication between Parent and Child Process
by shmem (Chancellor) on Oct 26, 2006 at 11:10 UTC |