-
what is usage of "class Ref { public T Value; }" |
Beta Was this translation helpful? Give feedback.
Answered by
dadhi
Oct 2, 2023
Replies: 1 comment
-
@vanasis The |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
dadhi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@vanasis The
Ref
is the helper abstraction to allow optimistic-concurrency Swap operation on theValue
.I am using it internally in DryIoc in concatenation with the immutable collections like
ImHashMap
to enable thread-safe set of the new value of the map without locking (this is the whole purpose of the optimistic concurrency). You may look through theRef.Swap
or just a.Swap
method usages inContainer.cs
for the examples.