Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Inter-Process Communication

by dpuu (Chaplain)
on Jul 21, 2002 at 02:29 UTC ( #183727=note: print w/replies, xml ) Need Help??


in reply to Inter-Process Communication

I'm not sure about the specifics of your Win32 installation. Under cygwin, fork and pipe are implemented, so the following code works:
pipe B,A; my $child = fork; die "fork: $!" unless defined $child; if ($child != 0) { use IO::Handle; close B; print A "hello\n"; A->flush; sleep 1; print A "world\n"; exit; } close A; while (<B>) { print; }
You can do use select to poll the filehandle. Of course, you could simply use your socket instead of opening the pipe. --Dave.

Replies are listed 'Best First'.
Re: Re: Inter-Process Communication
by Nitrox (Chaplain) on Jul 21, 2002 at 02:48 UTC
    I'm running ActiveState's Perl 5.6.1 build633 and your example runs without errors, but with odd results.

    It produces no output and hangs indefinetly, but when I ctrl-C the console it then outputs 'hello'. Seems to be a deadlock situation?

    Also, instead of fork'ing an entire copy, is there a way to spawn a thread that is capable of accessing variables in the parent thread?

    -Nitrox

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://183727]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2023-12-08 12:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (35 votes). Check out past polls.

    Notices?