Does O_NDELAY shred read(2)?
Conor P. Cahill
cpcahil at virtech.uucp
Sat Nov 11 13:55:51 AEST 1989
In article <20764 at ut-emx.UUCP>, jon at walt.cc.utexas.edu (Jon Boede) writes:
> If a write(fd,buf,X) is made, will a read(fd2,buf2,X) == X? In other words, I
> know that the write will be atomic... will the read also be? Is there a
Writes to a pipe are not atomic. They are dependent upon the size of the
buffer used by the kernel in transferring the data. And there is an upper
limmit on the amount of unread data in the pipe buffer so the write will pause
while the data is read.
Whether or not your example will work depends upon the smallness of X, the
ability of the writing process to call the write (does it have lots of data
ready to transfer), the ability of the reading process to read the data (how
much time does it spend processing the data), and, of course, it's all
implementation dependent.
--
+-----------------------------------------------------------------------+
| Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 !
| Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 |
+-----------------------------------------------------------------------+
More information about the Comp.lang.c
mailing list