The solution I can immediately think of is to create the activity bar (the 'monitoring process') first, and have it create the other as the child so that it knows its pid and can establish ipc structures before/after the fork. Something like the code below could be used.
This code does only creates the one other process however, so if you really want two subprocesses created you have to wrap it in another fork.pipe my $read, my $write; if (my $pid = fork()) { # monitor process close $write; read $read and update progress } else { close $read; while (1) { do stuff; print $write "status"; } }
--
integral, resident of freenode's #perl
In reply to Re: I want to launch two subroutines at once
by integral
in thread I want to launch two subroutines at once
by juo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |