package core

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
module Flags : sig ... end
type t = private Unix.file_descr
val compare : t -> t -> int
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.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_kernel.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_kernel.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 -> Unix.file_descr
OCaml

Innovation. Community. Security.