Module Eio_unixSource

Extension of Eio for integration with OCaml's Unix module.

Note that OCaml's Unix module is not safe, and therefore care must be taken when using these functions. For example, it is possible to leak file descriptors this way, or to use them after they've been closed, allowing one module to corrupt a file belonging to an unrelated module.

Sourcetype Eio.Exn.Backend.t +=
  1. | Unix_error of Unix.error * string * string
    (*

    Wrapper for embedding Unix.Unix_error errors.

    *)
Sourcemodule Fd : sig ... end

A safe wrapper for Unix.file_descr.

Sourcemodule Resource : sig ... end

Eio resources backed by an OS file descriptor.

Sourcemodule Net : sig ... end

Extended network API with support for file descriptors.

Sourcetype source_ty = [
  1. | `Unix_fd
  2. | Eio.Resource.close_ty
  3. | Eio.Flow.source_ty
]
Sourcetype sink_ty = [
  1. | `Unix_fd
  2. | Eio.Resource.close_ty
  3. | Eio.Flow.sink_ty
]
Sourcetype 'a source = [> source_ty ] as 'a Eio.Std.r
Sourcetype 'a sink = [> sink_ty ] as 'a Eio.Std.r
Sourceval await_readable : Unix.file_descr -> unit

await_readable fd blocks until fd is readable (or has an error).

Sourceval await_writable : Unix.file_descr -> unit

await_writable fd blocks until fd is writable (or has an error).

Sourceval sleep : float -> unit

sleep d sleeps for d seconds, allowing other fibers to run. This is can be useful for debugging (e.g. to introduce delays to trigger a race condition) without having to plumb Eio.Stdenv.mono_clock through your code. It can also be used in programs that don't care about tracking determinism.

Sourceval run_in_systhread : ?label:string -> (unit -> 'a) -> 'a

run_in_systhread fn runs the function fn using a pool of system threads (Thread.t).

This pool creates a new system thread if all threads are busy, it does not wait. run_in_systhread allows blocking calls to be made non-blocking.

  • parameter label

    The operation name to use in trace output.

pipe sw returns a connected pair of flows src and sink. Data written to sink can be read from src. Note that, like all FDs created by Eio, they are both marked as close-on-exec by default.

Sourcemodule Process : sig ... end

Spawning child processes with extra control.

Sourcemodule Cap : sig ... end

Capsicum security.

Sourcemodule Stdenv : sig ... end

The set of resources provided to a process on a Unix-compatible system.

Sourcemodule Private : sig ... end

API for Eio backends only.

Sourcemodule Pi : sig ... end