Up

Module Fd_by_descr

Fd_by_descr is a table of the open Fd.ts, indexed by file descriptor number.

In this interface, we use Raw_fd.t rather than Fd.t to avoid a dependency cycle, because the Fd module can't be defined yet.

Signature

type t
val sexp_of_t : t -> Sexplib.Sexp.t
include Core.Std.Invariant.S with type t := t
type t
val invariant : t Invariant_intf.inv
val create : num_file_descrs:int -> t
val add_exn : t -> Raw_fd.t -> unit

add_exn t fd fails if the file descriptor for fd is already in t.

val mem : t -> Import.File_descr.t -> bool
val find : t -> Import.File_descr.t -> Raw_fd.t option
val find_exn : t -> Import.File_descr.t -> Raw_fd.t
val remove : t -> Raw_fd.t -> unit
val fold : t -> init:'a -> f:('a -> Raw_fd.t -> 'a) -> 'a
val iter : t -> f:(Raw_fd.t -> unit) -> unit