Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Lockfree.Mpmc_relaxed_queueSourceA lock-free multi-producer, multi-consumer, thread-safe, relaxed-FIFO queue.
It exposes two interfaces: Spin and Not_lockfree. Spin is lock-free formally, but the property is achieved in a fairly counterintuitive way -
Above interface is impractical outside specialized applications. Thus, Mpmc_relaxed_queue also exposes Not_lockfree interface. Not_lockfree contains non-lockfree paths. While formally a locked algorithm, it will often be the more practical solution as it allows having an overflow queue, etc.
A queue of items of type 'a. Implementation exposed for testing.
create ~size_exponent:int creates an empty queue of size 2^size_exponent.
Spin exposes a formally lock-free interface as per the A lock-free relaxed concurrent queue for fast work distribution paper. Functions here busy-wait if the action cannot be completed (i.e. push on full queue, pop on empty queue).
Non_lockfree exposes an interface that contains non-lockfree paths, i.e. threads may need to cooperate to terminate. It is often more practical than Spin, in particular when using a fair OS scheduler.