package picos

  1. Overview
  2. Docs

Basic Unix.select based IO event loop for Picos.

The operations in this module automatically manage a Thread per domain that runs a Unix.select loop to support the operations.

⚠️ All the usual limitations of the Unix module apply.

Timeouts

val cancel_after : _ Picos.Computation.t -> seconds:float -> Picos.Exn_bt.t -> unit

cancel_after computation ~seconds exn_bt arranges for computation to be canceled with given exn_bt after given time in seconds. Completion of the computation before the specified time effectively cancels the timeout.

ℹ️ You can use cancel_after to implement the handler for the Cancel_after effect.

IO

val return_on : 'a Picos.Computation.t -> Picos_fd.t -> [ `R | `W | `E ] -> 'a -> unit

return_on computation fd op value arranges for computation to be returned with given value when fd becomes available for op. Completion of the computation before the fd becomes available for op effectively cancels the await.

ℹ️ Using Unix.set_nonblock and return_on you can implement direct-style transparently asynchronous IO on top of the Unix module.

val await_on : Picos_fd.t -> [ `R | `W | `E ] -> Picos_fd.t

await_on fd op awaits until fd becomes available for op.

module Intr : sig ... end

A mechanism to interrupt blocking Unix IO operations.

OCaml

Innovation. Community. Security.