package core_unix

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
module Flags : sig ... end
type t = private Core_unix.File_descr.t
include Ppx_compare_lib.Comparable.S with type t := t
val compare : t -> t -> int
val sexp_of_t : t -> Sexplib0.Sexp.t
val create : (?flags:Flags.t -> Core.Int32.t -> t) Core.Or_error.t

create ?flags init creates a new event file descriptor with init as the counter's initial value. With Linux 2.6.26 or earlier, flags must be empty.

val read : t -> Core.Int64.t

read t will block until t's counter is nonzero, after which its behavior depends on whether t was created with the Flags.semaphore flag set. If it was set, then read t will return 1 and decrement t's counter. If it was not set, then read t will return the value of t's counter and set the counter to 0. The returned value should be interpreted as an unsigned 64-bit integer.

In the case that t was created with the Flags.nonblock flag set, this function will raise a Unix error with the error code EAGAIN or EWOULDBLOCK, instead of blocking.

val write : t -> Core.Int64.t -> unit

write t v will block until t's counter is less than the max value of a uint64_t, after which it will increment t's counter by v, which will be interpreted as an unsigned 64-bit integer.

In the case that t was created with the Flags.nonblock flag set, this function will raise a Unix error with the error code EAGAIN or EWOULDBLOCK, instead of blocking.

val to_file_descr : t -> Core_unix.File_descr.t