This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class AtomicReference<T> | |
{ | |
private object _lock = new object(); | |
private T _value; | |
public AtomicReference(T value) => _value = value; | |
public void LockedUpdate(Func<T,T> updateFunc) | |
{ | |
lock(_lock) | |
{ |
NewerOlder