package eio

  1. Overview
  2. Docs
Effect-based direct-style IO API for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

eio-1.6.tbz
sha256=c1f04986b401094176494863dde1ca9b292b59fdc679a9d7023e558d80fb5b15
sha512=92ed8cf20300b8a4e0141bdbc373c0803c5a24530cb65852637d905fff4a5b956a8859a00a424034ff78c1112da9b0391194bcd558326168bdebd1ce683a8890

doc/eio/Eio/Private/Broadcast/index.html

Module Private.BroadcastSource

A lock-free queue of waiters that should all be resumed at once.

This uses Cells internally.

Sourcetype t
Sourcetype request

A handle to a pending request that can be used to cancel it.

Sourceval create : unit -> t

create () is a fresh broadcast queue.

Sourceval suspend : t -> (unit -> unit) -> request option

suspend t fn arranges for fn () to be called on resume_all.

fn () may be called from the caller's context, or by resume_all, so it needs to be able to cope with running in any context where that can run. For example, fn must be safe to call from a signal handler if resume_all can be called from one. fn must not raise.

The returned request can be used to cancel. It can be None in the (unlikely) event that t got resumed before the function returned.

Sourceval resume_all : t -> unit

resume_all t calls all non-cancelled callbacks attached to t, in the order in which they were suspended.

This function is lock-free and can be used safely even from a signal handler or GC finalizer.

Sourceval cancel : request -> bool

cancel request attempts to remove a pending request.

It returns true if the request was cancelled, or false if it got resumed before that could happen.

Sourceval dump : Format.formatter -> t -> unit

Display the internal state of a queue, for debugging.