package saturn_lockfree

  1. Overview
  2. Docs

Module Work_stealing_deque.MSource

Sourcetype 'a t

Type of work-stealing queue

Sourceval create : unit -> 'a t

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

Queue owner functions

Sourceval 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.

Sourceval 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.

Sourceval 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

Sourceval 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.

Sourceval 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.