Ah, my bad, sorry for the noise!

Le 18 août 2014 18:58, "Xavier Leroy" <Xavier.Leroy@inria.fr> a écrit :
On 18/08/14 18:52, Thomas Braibant wrote:

> Well, I was thinking about the following situation
>
>   let open Unix in
>   let fd = openfile "foo.bar" [O_RDWR; O_TRUNC; O_CREAT] 0o640 in
>   let o = out_channel_of_descr fd in
>   let i = in_channel_of_descr fd in
>   let i2 = in_channel_of_descr fd in
>   Printf.printf "1\n%!";
>   close_in i;
>   Printf.printf "2\n%!";
>   close_in i2;
>   Printf.printf "3\n%!";
>   close_out o;
>   Printf.printf "Ok\n%!"
>
> that raises the fatal error: exception Sys_error("Bad file
> descriptor"), and now, I do not understand your remark either :(.

I said "close all your channels at once when you're done with the
underlying file descriptor".  What you observe is that after the first
close_in, all the other channels are unusable, because the underlying
FD is closed.

- Xavier Leroy

--
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs