Idris2Doc : System.Linux.EventFD

System.Linux.EventFD

(source)
This provides wrappers around the `sys/eventfd.h` module: An "event"
file descriptort that can be monitored via `epoll` and written to
programmatically to wake up a dormant thread.

The file descriptor can work in `EFD_SEMAPHORE` mode, in which case it
can indeed be used liked a `System.Concurrent.Semaphore` or a
`System.Concurrent.Condition`.

Definitions

record Flags : Type
  Flags describing the behavior of an event file descriptor.

Several flags can be combined using `(<+>)`.

Totality: total
Visibility: export
Constructor: 
F : Bits32 -> Flags

Projection: 
.value : Flags -> Bits32

Hints:
Eq Flags
Monoid Flags
Ord Flags
Semigroup Flags
Show Flags
flagCode : Flags -> Bits32
Totality: total
Visibility: export
EFD_CLOEXEC : Flags
Totality: total
Visibility: export
EFD_NONBLOCK : Flags
  Sets the file descriptor to non-blocking: Reading from
an `EventFD` via `readEv` will usually block the calling thread
unless the file descriptor's stored value is greater than zero.

With this flag being set, `readEv` will never block but will return
`Left EAGAIN` in case of an empty file descriptor.

Totality: total
Visibility: export
EFD_SEMAPHORE : Flags
  Changes the file descriptor to work in "semaphore mode": Usually,
`readEv` will return the whole 64-bit value currently stored in the
file descriptor. In semaphore mode, `readEv` will always return 1
(unliss the file descriptor is empty) and likewise reduce the stored
value by 1.

Totality: total
Visibility: export
record EventFD : Type
  An event file descriptor that can be monitored via `epoll`
and programmatically written to and read from.

Totality: total
Visibility: public export
Constructor: 
EFD : Bits32 -> EventFD

Projection: 
.file : EventFD -> Bits32

Hint: 
FileDesc EventFD
.file : EventFD -> Bits32
Totality: total
Visibility: public export
file : EventFD -> Bits32
Totality: total
Visibility: public export
eventfd : Bits64 -> Flags -> PrimIO EventFD
  Creates a new `EventFD` with the given initial value a flags set.

Totality: total
Visibility: export
writeEv : EventFD -> Bits64 -> PrimIO ()
  Writes (adds) the given 64-bit value to the value currently stored
in the given event file descriptor.

Totality: total
Visibility: export
readEv : EventFD -> PrimIO (Either EpollErr Bits64)
  Reads the current value from an event file descriptor, setting the
stored value to 0.

If the `EFD_SEMAPHORE` flag was set when creating the file descriptor,
this will always return 1 in case the event file is non-empty. Likewise,
the value stored in the event file will be reduced by one.

Totality: total
Visibility: export
withEv : Bits64 -> Flags -> (EventFD -> PrimIO a) -> PrimIO a
  Creates and finally closes and event file descriptor.

Totality: total
Visibility: export