At 11:39 AM 11/21/2001 -0500, Tom Edelson wrote:
>With those changes, in my environment, it still hangs on the second call to
>synchronize ().
>
>The output I would want to get is something like this:
<snip>
>Did you get something more-or-less like that with your changed script, in your
>environment?
Yep, both with bleadperl and with 5.6.1.
>I can see that it could be helpful to explain what I'm attempting here. I want to
>start a slave process: my Perl program sends DCL commands to it, and it processes
>them. For what I want this "DCL server process" to do (which includes multiple runs
>of SAS), if I can get this working, it will be a lot easier, and a bit more
>efficient, than repeated use of system () or backticks.
Interesting. Why the SPAWN within the pipe since the pipe already creates a
subprocess?
>A challenge to this approach is that sometimes the Perl program needs to synchronize
>on its DCL server process, that is, to wait until the server has finished running all
>the commands fed to it so far. My synchronize function (repeated below) attempts to
>address that as follows: set up a local handler for SIGALRM; then send the server
>process one more command, which tells it to send the signal back to me; then go to
>sleep and wait for the signal to arrive.
>
>--snip--
>
>sub synchronize {
>
> eval {
> local $SIG {ALRM} = sub {die;};
> print $writeme "PERL -e \"print kill (SIGALRM, 0x$pid)\"\n";
If you are using, as I suggested, "$pid=$$;" to get the pid, then you'll
want to lose the 0x in front of it as it's an integer in decimal. You might
be signaling the wrong (nonexistent) process.