Module Linux_ext.Eventfd
module Flags : sig ... end
type t
= private Core.Unix.File_descr.t
val compare : t -> t -> int
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
val create : (?flags:Flags.t -> Core.Int32.t -> t) Core.Or_error.t
create ?flags init
creates a new event file descriptor withinit
as the counter's initial value. With Linux 2.6.26 or earlier,flags
must beempty
.
val read : t -> Core.Int64.t
read t
will block untilt
's counter is nonzero, after which its behavior depends on whethert
was created with theFlags.semaphore
flag set. If it was set, thenread t
will return1
and decrementt
's counter. If it was not set, thenread t
will return the value oft
's counter and set the counter to0
. The returned value should be interpreted as an unsigned 64-bit integer.In the case that
t
was created with theFlags.nonblock
flag set, this function will raise a Unix error with the error codeEAGAIN
orEWOULDBLOCK
, instead of blocking.
val write : t -> Core.Int64.t -> unit
write t v
will block untilt
's counter is less than the max value of auint64_t
, after which it will incrementt
's counter byv
, which will be interpreted as an unsigned 64-bit integer.In the case that
t
was created with theFlags.nonblock
flag set, this function will raise a Unix error with the error codeEAGAIN
orEWOULDBLOCK
, instead of blocking.