comp.lang.ada
 help / color / mirror / Atom feed
* Opening a fifo hangs
@ 1999-02-18  0:00 John I Quist
  1999-02-18  0:00 ` robert_dewar
  0 siblings, 1 reply; 7+ messages in thread
From: John I Quist @ 1999-02-18  0:00 UTC (permalink / raw)


Hi!

I'm tring to establish communication between two processes on the same 
Sun machine. (SunOS 5.6; running GNAT 3.05)

I have created two named pipes, and if I open two terminals, I can do
the following, without a problem:

In /dev/pts/3 (e.g.)
cat > mypipe
typetypetype
^D

In /dev/pts/4
cat mypipe

As expected, the text typed into the pipe on "pts/3" arrives neatly
on "pts/4"... 

BUT, if I make a small Ada hack to open the pipes and read/write to them,
one program reads and the other writes, the program hangs.
The lines where execution halts are:

--- Write side ---
open(IN_F, IN_FILE, "/users/ztek/z93john/.comm_pipe");
------------------

--- Read side ---
open(OUT_F, OUT_FILE, "/users/ztek/z93john/.comm_pipe");
-----------------

(Both programs use TEXT_IO)


If I run "truss" to get the system calls, I find that both programs do
open("/users/ztek/z93john/.comm_pipe", O_RDONLY) (sleeping...)

BUT; if I kill the "writer" and do a 
cat > .comm_pipe [Return]
the "reader" opens the fifo!

Why doesn't the writer open the pipe? 
I have read the GNAT reference, and I didn't get much wiser...
- Is Ada doing something weird here, or is it me? 

(As I understand it, the programs are supposed to block until both 
ends of the pipe are open, but that's what I'm doing, isn't it?
Open for write on one end, read on the other...)


I would really appreciate an email copy of your replies.

Thank you!
/John.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1999-02-22  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-18  0:00 Opening a fifo hangs John I Quist
1999-02-18  0:00 ` robert_dewar
1999-02-19  0:00   ` John I Quist
1999-02-19  0:00     ` robert_dewar
1999-02-22  0:00       ` John I Quist
1999-02-22  0:00         ` dennison
1999-02-22  0:00           ` John I Quist

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox