Open
Description
Would be useful to have a little File module to read/write files in a scheduler-friendly way.
In short, we would need a module like Net.Socket
with functions like:
File.open file
that returns aFd.t
File.read fil
that return an(Bigstringaf.t, _) result
File.write file ~data
Internally these functions can call the I/O module to do the actual reading/writing, they just have to beware that if the I/O module says `Retry
then you have to call syscall "debugging-name" fd @@ fun fd -> (* do work here *)
like this:
let rec read
59D4
fd ~buf =
match IO.read fd buf with
| `Retry -> syscall "file.read" `r fd @@ read ~buf
(* ... *)
This way we would tell the scheduler we're waiting, and some other process can run.