picos.mpsc_queue
Picos_mpsc_queue
Multi-producer, single-consumer queue.
🏎️ This data structure is optimized for use as a scheduler's ready queue.
picos
picos.domain
picos.exn_bt
picos.fd
picos.fifos
picos.htbl
picos.rc
picos.select
picos.stdio
picos.sync
picos.threaded
picos.tls
type !'a t
A multi-producer, single-consumer queue.
val create : unit -> 'a t
create () returns a new empty multi-producer, single-consumer queue.
create ()
val push : 'a t -> 'a -> unit
push queue value adds the value to the tail of the queue.
push queue value
value
queue
val push_head : 'a t -> 'a -> unit
push_head queue value adds the value to the head of the queue.
push_head queue value
exception Empty
Raised by pop_exn in case it finds the queue empty.
pop_exn
val pop_exn : 'a t -> 'a
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_exn queue
Empty
⚠️ This should only be called by the owner / consumer of the queue.
in case the queue was empty.