That is handy to know. Thanx for the info. Cheers, John
> -----Original Message----- > From: Eugeniy Ogloblin [mailto:[EMAIL PROTECTED]] > Sent: Monday, May 13, 2002 2:41 PM > To: [EMAIL PROTECTED] > Subject: Re[2]: Beating the fork() horse to death... > > > Hello John, > > Monday, May 13, 2002, 9:25:15 AM, you wrote: > > JS> You have to remember that at the time of the fork a > snapshot is taken of the > JS> parent process's variables and memory and reproduced for > the child. If you > JS> want the parent to know the results of whatever you do in > the child, you > JS> have three options: > JS> 1. Write the results from the child to a file and have > the parent read it, > JS> 2. Open a pipe between the child and the parent and pipe > the results back to > JS> the parent, > JS> 3. Open a socket for child/parent communications. > > JS> Since the fork produces another process, all memory is > separate as the > JS> processes are two totally different entities which is why > you require one of > JS> the above techniques for inter process communications. > > it's not a strong rule > > > For instance, exists one tricky way for the interaction > between parent and child processes in ActiveState Perl. > If you create Win32::GUI object before calling fork , it will > be global for all processes. > And you will be able to ensure interprocess interaction with its help. > > use Win32::GUI; > $|++; > > $w=new Win32::GUI::Window( > -name => "win", > -text => 1, > ); > $t=$w->AddTimer("timer1",1500); > > my $pid=fork; > if($pid){ > my $pid2=fork; > if($pid2){ > Win32::GUI::Dialog(); > } > else{ > while(1){ > $w->Text($w->Text+1);#this child process set global variable > sleep 2; > } > } > } > else{ > while(1){ > print $w->Text."\n"; #another child process print global > variable value > sleep 1; > } > } > > > > -- > Best regards, > Eugeniy mailto:[EMAIL PROTECTED] > > > _______________________________________________ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs