8000 Create scheduler friendly FS module · Issue #21 · riot-ml/riot · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Create scheduler friendly FS module #21
Open
@leostera

Description

@leostera

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 a Fd.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0