Crate concurrent_list

Source
Expand description

A lockless append-only unrolled linked list, with a single writer and multiple independent readers.

The list is represented by a Writer-Reader pair, created by new. The data is stored in contiguous chunks of increasing size, allocated as needed by Writer::push() and stored in a linked list. Pushing a new value in the list is a O(1) operation.

The Reader can be cloned and can iterate over the data, yielding pinned references to each element in order. The iteration gracefully stops at the end of the list and can be resumed. Advancing the iteration is a O(1) operation.

Both the Writer and the Readers hold a reference count over the list, which is deallocated when the Writer and all the Readers are dropped.

Structs§

Iter
Iterator over the list. The iteration returns None when there’s currently no more item in the list, but can be resumed at a later time.
Reader
Read half of a concurrent_list; it can be cloned and it can be iterated over, to go through the elements of the list.
Writer
Write half of a concurrent_list; can only push() a value to the end of the list, allocating new chunks if necessary.

Functions§

new
Creates a Writer and a Reader for the same concurrent_list; the Writer can be used to append to the list, the Reader can be cloned and can iterate over the current contents of the list.