single_writer_versioned | The single_writer_versioned module implements a versioning mechanism for immutable data-structures
which allows many concurrent readers. All changes to the contained data structure - which, since they
are immtuable, means a creating a new instance - are delegated to a single task, and hence occur
sequentially. Each new update is appended to a linked list of versions, and an atomic integer is used to
indicate which is the latest version, so readers can retrieve the latest version when they read. This integer
acts in place of a locked on the linked list element, so that no actual locks are required and reads can always
proceed without waiting.
|