package kcas_data

  1. Overview
  2. Docs

Explicit transaction log passing on queues.

val is_empty : xt:'x Kcas.Xt.t -> 'a t -> bool

is_empty s determines whether the queue q is empty.

val length : xt:'x Kcas.Xt.t -> 'a t -> int

length q returns the length of the queue q.

val clear : xt:'x Kcas.Xt.t -> 'a t -> unit

clear q removes all elements from the queue q.

val swap : xt:'x Kcas.Xt.t -> 'a t -> 'a t -> unit

swap q1 q2 exchanges the contents of the queues q1 and q2.

val to_seq : xt:'x Kcas.Xt.t -> 'a t -> 'a Seq.t

to_seq s returns a domain safe sequence for iterating through the elements of the queue front to back.

The sequence is based on a constant time, O(1), snapshot of the queue and modifications of the queue have no effect on the sequence.

val add : xt:'x Kcas.Xt.t -> 'a -> 'a t -> unit

add x q adds the element x at the end of the queue q.

val push : xt:'x Kcas.Xt.t -> 'a -> 'a t -> unit

push is a synonym for add.

val peek_opt : xt:'x Kcas.Xt.t -> 'a t -> 'a option

peek_opt q returns the first element in queue q, without removing it from the queue, or returns None if the queue is empty.

val peek_blocking : xt:'x Kcas.Xt.t -> 'a t -> 'a

peek_blocking q returns the first element in queue q, without removing it from the queue, or blocks waiting for the queue to become non-empty.

val take_blocking : xt:'x Kcas.Xt.t -> 'a t -> 'a

take_blocking q removes and returns the first element in queue q, or blocks waiting for the queue to become non-empty.

val take_opt : xt:'x Kcas.Xt.t -> 'a t -> 'a option

take_opt q removes and returns the first element in queue q, or returns None if the queue is empty.

val take_all : xt:'x Kcas.Xt.t -> 'a t -> 'a Seq.t

take_all q removes and returns a domain safe sequence for iterating through all the elements that were in the queue front to back.

OCaml

Innovation. Community. Security.