Module arc_swap::gen_lock[][src]

Customization of where and how the generation lock works.

By default, all the ArcSwapAny instances share the same generation lock. This is to save space in them (they have the same size as a single pointer), because the default lock is quite a large data structure (it’s sharded, to prevent too much contention between different threads). This has the disadvantage that a lock on one instance influences another instance.

The things in this module allow customizing how the lock behaves. The default one is Global. If you want to use independent but unsharded lock, use the PrivateUnsharded (or the IndependentArcSwap type alias).

Or you can implement your own lock, but you probably should study the internals of the library first.

Not Implemented Yet

These variants would probably make sense, but haven’t been written yet:

Structs

Global

The default, global lock.

PrivateSharded

An alternative to PrivateUnsharded, but with configurable number of shards.

PrivateUnsharded

A single „shard“ that is stored inline, inside the corresponding ArcSwap. Therefore, locks on each instance won’t influence any other instances. On the other hand, the ArcSwap itself gets bigger and doesn’t have multiple shards, so concurrent uses might contend each other a bit.

Shard

A single shard.

Traits

LockStorage

Abstraction of the place where generation locks are stored.