Thread: Dangerous to write to same pipe from 2 or more processes?

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    35

    Dangerous to write to same pipe from 2 or more processes?

    Title pretty much covers it.
    I have a program with a variable number of childś writing to the same pipe, from witch the father reads.
    Is this dangerous? can data be corrupted if execution jumps to another child, in the middle of the write, or is the write done in one cycle?

    Thank You

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    http://www.minix3.org/manpages/man2/pipe.2.html
    A single write() up to PIPE_MAX is atomic.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    35
    thank you

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. cont of IPC using PIPE
    By BMathis in forum C Programming
    Replies: 1
    Last Post: 03-15-2009, 05:16 PM
  2. Same pipe to multiple processes?
    By Ironic in forum C Programming
    Replies: 7
    Last Post: 10-25-2008, 10:10 AM
  3. Having trouble with a named pipe
    By crazeinc in forum C Programming
    Replies: 2
    Last Post: 05-13-2005, 01:00 AM
  4. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  5. This should be the Cprogramming.com anthem!
    By Brian in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 01-21-2002, 12:01 AM