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

This is a discussion on Dangerous to write to same pipe from 2 or more processes? within the C Programming forums, part of the General Programming Boards category; Title pretty much covers it. I have a program with a variable number of childś writing to the same pipe, ...

  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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,668
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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, 01: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-20-2002, 11:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21