* Read error
@ 2002-04-23 8:47 Hemant Mohan
2002-04-23 10:27 ` Glynn Clements
2002-04-23 10:32 ` weener
0 siblings, 2 replies; 3+ messages in thread
From: Hemant Mohan @ 2002-04-23 8:47 UTC (permalink / raw)
To: linux-c-programming
I am writing a program whereby I am opening a FIFO for reading. However the
read is getting blocked though another process has already written to the
FIFO and no other process is accesiing this FIFO.
the program is something like:
Process A
main()
{
int fd;
fd=open(FIFO, RD_ONLY );
read(fd, ....)
}
Process B
main()
{
mkfifo(FIFO, 0664);
fd =open(FIFO, WR_ONLY);
write(fd, ...);
printf("data written to fifo\n");
}
Process B is run before process A, and the printf statement is desiplayed on
the screen.
But I find that inspite of this process B is blocked on the read as if there
is no data in the FIFO.
However if in process B, the open is done in non blocking mode
fd = open(FIFO, RD_ONLY | O_NONBOCK)
then it doesn't block on read, but read returns a negative value and the
errorno is set, with the message "Resource temporarily unavailable".
My question is that why does the read block initially, when there is some
data for it to read. Under what conditions does the read normally block.
Thanks,
Hemant Mohan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-04-23 10:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-23 8:47 Read error Hemant Mohan
2002-04-23 10:27 ` Glynn Clements
2002-04-23 10:32 ` weener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).