Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Using pipe with more than one child process

by thospel (Hermit)
on Jan 06, 2005 at 05:47 UTC ( [id://419814]=note: print w/replies, xml ) Need Help??


in reply to Using pipe with more than one child process

Writes to a pipe are atomic as long as they are short enough. This atomic size can be found in your systems header files as the constant PIPE_BUF, and it's defined by posix to be at least 512 bytes (on linux for example it's 4096 bytes). At the perl level the constant can be found in POSIX.pm:
perl -wle 'use POSIX; print PIPE_BUF'

So if you make sure that your filehandle to the pipe is autoflushing (so that perl prints become one write), the filehandle isn't unbuffered (normally only a problem with STDERR, in that case make sure your print doesn't consist of many pieces) and your message is short enough (<= 512 bytes), you're safe.

Replies are listed 'Best First'.
Re^2: Using pipe with more than one child process
by Gmong (Novice) on Jan 06, 2005 at 21:29 UTC
    Thanks heaps thospel.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-18 13:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found