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:
- A lock storage that is shared, but only between a certain group of pointers. It could be
either as a reference (but then each
ArcSwap
would get a bit bigger), or a macro that could generate an independent but global storage.
Structs
Global | The default, global lock. |
PrivateSharded | An alternative to |
PrivateUnsharded | A single „shard“ that is stored inline, inside the corresponding |
Shard | A single shard. |
Traits
LockStorage | Abstraction of the place where generation locks are stored. |