Add Eio_unix.File module - #937
Conversation
| val import_rw : Fd.t -> [< rw_ty ] r | ||
| (** [import_rw fd] is a read/write Eio file that uses [fd]. | ||
| [fd] should be non-blocking (at least for pipes). |
There was a problem hiding this comment.
I think that pipes do actually block in our current implementation of them on Windows (#929), at least until we shift to IOCP (which does support it I think but is a huge change for that backend)
There was a problem hiding this comment.
Does the comment need changing then? What happens if you open a pipe in non-blocking mode and pass it to the Windows backend?
There was a problem hiding this comment.
It raises ENOTSOCK and all hell breaks loose. But #929 does fix this now by running them in a systhread (i.e. treat it like a file). It does mark a pipe fd as blocking, though (which is what contradicts the comment above)
There was a problem hiding this comment.
OK, I've removed the stuff about pipes and blocking modes. It's now the backend's responsibility to set it to be non-blocking, if appropriate. Opening a pipe as a file doesn't really make sense anyway.
be96c70 to
08dcd49
Compare
Allows creating Eio files and flows from FDs. In fact, it was possible to do this before using `Eio_unix.Net.import_socket_stream`, but that wasn't obvious.
Allows creating Eio files and flows from FDs.
In many cases it was possible to do this before using
Eio_unix.Net.import_socket_stream, but that wasn't obvious and doesn't provide support for e.g.pread(see e.g. #899 (comment)).