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; }
In reply to Re^2: IPC and communication between Parent and Child Process
by hengha
in thread IPC and communication between Parent and Child Process
by hengha
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |