package saturn_lockfree

  1. Overview
  2. Docs
type 'a t

Type of work-stealing queue

val create : unit -> 'a t

create () returns a new empty work-stealing queue.

Queue owner functions

val push : 'a t -> 'a -> unit

push t v adds v to the front of the queue q. It should only be invoked by the domain which owns the queue q.

val pop : 'a t -> 'a

pop q removes and returns the first element in queue q.It should only be invoked by the domain which owns the queue q.

  • raises [Exit]

    if the queue is empty.

val pop_opt : 'a t -> 'a option

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

Stealers function

val steal : 'a t -> 'a

steal q removes and returns the last element from queue q. It should only be invoked by domain which doesn't own the queue q.

  • raises [Exit]

    if the queue is empty.

val steal_opt : 'a t -> 'a option

steal_opt q removes and returns the last element from queue q, or returns None if the queue is empty. It should only be invoked by domain which doesn't own the queue q.

OCaml

Innovation. Community. Security.