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.