poll : Has Errno es => PollH e => FileDesc f => f -> PollEvent -> Async e es PollEvent Polls the file descriptor for the given events without blocking
an operating system thread.
If the file descriptor does not support polling, for instance,
because it is a regular file, this will immediately return
`ev`.
Totality: total
Visibility: exportonEvent : Has Errno es => PollH e => FileDesc f => f -> PollEvent -> Async e es a -> Async e es a Runs a computation after polling a file descriptor.
This allows us to read from or write to a file descriptor
without blocking an operating system thread.
Totality: total
Visibility: exportreadnb : Has Errno es => PollH e => FileDesc f => f -> (0 r : Type) -> FromBuf r => Bits32 -> Async e es r Reads from a file descriptor without blocking.
If the descriptor corresponds to a regular file, this will just
read up to the given amount of bytes from the file. If the descriptor
corresponds to a socket or FIFO (pipe), the `O_NONBLOCK` flag of
the descriptor *must* have been set (via `addFlags` for instance).
This will then first try to read from the descriptor without
polling, and if this fails with `EAGAIN`, proper file polling is used.
Totality: total
Visibility: exportreadRawNb : Has Errno es => PollH e => FileDesc f => f -> Buf -> Async e es EMBuffer Like `readnb` but reads data into a pre-allocated buffer.
If the descriptor corresponds to a regular file, this will just
read up to the given amount of bytes from the file. If the descriptor
corresponds to a socket or FIFO (pipe), the `O_NONBLOCK` flag of
the descriptor *must* have been set (via `addFlags` for instance).
Totality: total
Visibility: exportreadPtrNB : Has Errno es => PollH e => FileDesc f => f -> (0 r : Type) -> FromPtr r => CPtr -> Async e es r Like `readnb` but reads data into a pre-allocated C-pointer and
converts it from there.
This is useful for re-using a (reasonably large) buffer when
streaming lots of comparably small chunks of data. Instead of
allocating a new - potentially much too large - buffer with every
read (as is the case with `readnb`), we allocate a buffer once
and copy only the bytes we actually read into an immutable
data type such as a string or byte vector.
Totality: total
Visibility: exportwritenb : Has Errno es => PollH e => FileDesc f => f -> ToBuf r => r -> Async e es Bits32 Writes to a file descriptor without blocking.
If the descriptor corresponds to a regular file, this will just
write up to the given amount of bytes to the file. If the descriptor
corresponds to a socket or FIFO (pipe), the `O_NONBLOCK` flag of
the descriptor *must* have been set (via `addFlags` for instance).
This will then first try to write to the descriptor without
polling, and if this fails with `EAGAIN`, proper file polling is used.
Totality: total
Visibility: exportfwritenb : Has Errno es => PollH e => FileDesc f => f -> ToBuf r => r -> Async e es () Iteratively writes a value to a file descriptor making sure
that the whole value is written. Use this, if a single call to
`write` might not write the complete data (for instance, when
writing to a pipe or socket).
Totality: total
Visibility: exportstream : Has Errno es => PollH e => FileDesc f => f -> (0 r : Type) -> FromBuf r => Bits32 -> (r -> Async e es ()) -> Async e es () Continously reads and transforms data from a file
descriptor without blocking.
Visibility: exportstreamp : Has Errno es => PollH e => FileDesc f => f -> (0 r : Type) -> FromPtr r => CPtr -> (r -> Async e es ()) -> Async e es () Continously reads and transforms data from a file
descriptor without blocking by loading data into a
preallocated pointer.
For very large files, this can be faster than `stream` if
the data in question can be transformed in place without allocating
additional memory. This also allows us to use a very large buffer
even in case we often only read small amounts of data.
Visibility: exportsleepTill : TimerH e => (Tm -> Clock UTC) -> Async e es () Wait until the given UTC time, which is computed from the
current time.
Totality: total
Visibility: exportnextMinute : Tm -> Clock UTC Computes local time of the next full minute.
Totality: total
Visibility: exportnextHour : Tm -> Clock UTC Computes local time of the next full hour.
Totality: total
Visibility: exportnextDay : Tm -> Clock UTC Computes local time of 00:00:00 of the next day.
Totality: total
Visibility: exportnextYear : Tm -> Clock UTC Computes local time of 00:00:00 on January 1 of the next day.
Totality: total
Visibility: exportnextMonth : Tm -> Clock UTC Computes local time of 00:00:00 of the first day of the next month.
Totality: total
Visibility: exportnextWeek : Tm -> Clock UTC Computes local time of 00:00:00 of the next Sunday
Totality: total
Visibility: export