package kcas_data

  1. Overview
  2. Docs

Module Queue.TxSource

Transactions on queues.

Sourceval is_empty : 'a t -> bool Kcas.Tx.t

is_empty s determines whether the queue q is empty.

Sourceval length : 'a t -> int Kcas.Tx.t

length q returns the length of the queue q.

Sourceval clear : 'a t -> unit Kcas.Tx.t

clear q removes all elements from the queue q.

Sourceval swap : 'a t -> 'a t -> unit Kcas.Tx.t

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

Sourceval to_seq : 'a t -> 'a Seq.t Kcas.Tx.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.

Sourceval add : 'a -> 'a t -> unit Kcas.Tx.t

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

Sourceval push : 'a -> 'a t -> unit Kcas.Tx.t

push is a synonym for add.

Sourceval peek_opt : 'a t -> 'a option Kcas.Tx.t

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

Sourceval take_opt : 'a t -> 'a option Kcas.Tx.t

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

OCaml

Innovation. Community. Security.