Class SpinLockBuffer<T>
A buffer that uses a SpinLock for locking
Inheritance
System.Object
SpinLockBuffer<T>
Namespace: Eco.Shared.Collections
Assembly: Eco.Shared.dll
Syntax
public class SpinLockBuffer<T> : Object
Type Parameters
Name | Description |
---|---|
T |
Constructors
SpinLockBuffer()
Declaration
public SpinLockBuffer()
Fields
Buffer
Declaration
protected readonly PoolableListWrapper<T> Buffer
Field Value
Type | Description |
---|---|
PoolableListWrapper<T> |
Methods
Add(T)
Add an item to the internal buffer.
Declaration
public void Add(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item |
AddRange(ICollection<T>)
Declaration
public void AddRange(ICollection<T> items)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.ICollection<T> | items |
Clear()
Clear the internal buffer.
Declaration
public void Clear()
FlushTo(PoolableListWrapper<T>)
Copy the contents to the given list then clear the internal buffer.
Declaration
public void FlushTo(PoolableListWrapper<T> list)
Parameters
Type | Name | Description |
---|---|---|
PoolableListWrapper<T> | list |
FlushTo(HashSet<T>)
Copy the contents to the given set then clear the internal buffer.
Declaration
public void FlushTo(HashSet<T> set)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.HashSet<T> | set |
FlushTo(List<T>)
Copy the contents to the given list then clear the internal buffer.
Declaration
public void FlushTo(List<T> list)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<T> | list |
FlushTo(Queue<T>)
Copy the contents to the given queue then clear the internal buffer.
Declaration
public void FlushTo(Queue<T> queue)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Queue<T> | queue |
FlushToSnapshotAndPromiseToReturn(out List<T>)
Flushes buffer content and outputs it as snapshot
.
Returns a promise which should be disposed to return snapshot
back to pool.
Declaration
public Nullable<ListPool<T>.ReturnPromise> FlushToSnapshotAndPromiseToReturn(out List<T> snapshot)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<T> | snapshot |
Returns
Type | Description |
---|---|
System.Nullable<ListPool.ReturnPromise<>> |
GetSnapshotAndClear()
Returns snapshot of buffer and clears it.
Declaration
protected List<T> GetSnapshotAndClear()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<T> |