Browse thread
Named pipe problem: is this a bug?
-
Alan Schmitt
- Virgile Prevosto
- Damien Bobillot
- Richard Jones
- Alan Schmitt
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Virgile Prevosto <virgile.prevosto@m...> |
| Subject: | Re: [Caml-list] Named pipe problem: is this a bug? |
Le 08/01/2005, à 05:03:42 PM, Alan Schmitt a écrit: > let _ = > Unix.mkfifo "pipe_test" 0o640; > print_endline "pipe created"; > flush stdout; > let chin = open_in "pipe_test" in > print_endline "pipe opened"; > flush stdout > > Compile it using "ocamlc unix.cma bug.ml" (the bug occurs both in > bytecode and native code). When a.out is run, one sees: > pipe created > and the program keeps running. If one then does a > echo foo >> pipe_test > then the "pipe opened" line is shown, and the program terminates. > > Is this behaviour normal? > Hello Allan, this corresponds to what the manual page of fifo says (at least under linux) The FIFO must be opened on both ends (reading and writing) before data can be passed. Normally, opening the FIFO blocks until the other end is opened also. If you don't want that behavior, you'll have to open pipe_test in non-blocking mode (e.g. with open_in_gen and the Open_nonblock flag) By the way, what is the purpose of the Open_rdonly and Open_wronly flags, given that the open_in* and open_out* functions return values of different types? -- E tutto per oggi, a la prossima volta Virgile