public void Add(int v) { while (true) { var local = Volatile.Read(ref _data); var copy = new CyclicArray(local); // Assume an initial parent thread creates this instance (so no null check on _data) copy.Add(v); if (Interlocked.CompareExchange(ref _data, copy, local) == local) { break; } } }
public RWLockList(int capacity) { _data = new CyclicArray(capacity); }
public MultipleWriterCOWList(int capacity) { _data = new CyclicArray(capacity); }