package picos
Pico scheduler interface
Install
Dune Dependency
Authors
Maintainers
Sources
picos-0.4.0.tbz
sha256=343a8b4759239ca0c107145b8e2cc94c14625fecc0b0887d3c40a9ab7537b8da
sha512=db22b0a5b3adc603c0e815c9011c779f892b9ace76be018b2198d3e24a7d96727c999701025fe5a5fd07d0b452cb7286fc50c939aba0e4dce809941e9ebc12a6
doc/picos.mpscq/Picos_mpscq/index.html
Module Picos_mpscq
Source
Lock-free multi-producer, single-consumer queue.
🏎️ This data structure is optimized for use as a non-work-stealing scheduler's ready queue.
API
A multi-producer, single-consumer queue.
Interface for producers
ℹ️ The operations in this section can be called by both any number of producers and the single owner / consumer of the queue.
push_head queue value
adds the value
to the head of the queue
.
Interface for the owner / consumer
⚠️ The operations in this section should only be called by the single owner / consumer of the queue.
pop_exn queue
tries to remove the value at the head of the queue
. Returns the removed value or raises Empty
in case the queue was empty.
pop_all queue
removes all values from the queue
and returns them as a sequence.
Examples
An example top-level session:
# let q : int Picos_mpscq.t =
Picos_mpscq.create ()
val q : int Picos_mpscq.t = <abstr>
# Picos_mpscq.push q 42
- : unit = ()
# Picos_mpscq.push_head q 76
- : unit = ()
# Picos_mpscq.push q 101
- : unit = ()
# Picos_mpscq.pop_exn q
- : int = 76
# Picos_mpscq.pop_all q |> List.of_seq
- : int list = [42; 101]
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page