Show / Hide Table of Contents

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>

Extension Methods

CommandLine.FeedFromCommandLine(Object)
CommandLine.ToCommandLineArgs(Object, Func<Object, Boolean>)
ListUtil.DepthFirstTraversal<T>(T, Func<T, IEnumerable<T>>)
EnumerableExtensions.SingleItemAsEnumerable<T>(T)
EventUtils.RaiseEvent<TEventArgs>(Object, String, TEventArgs)
PredicateUtils.MatchesAll<TEnumerable, T>(T, TEnumerable)
PredicateUtils.MatchesAll<T>(T, Func<T, Boolean>[])
PredicateUtils.MatchesAny<TEnumerable, T>(T, TEnumerable)
ReflectionUtils.PropertyValue<T>(Object, PropertyInfo)
ReflectionUtils.TryGetPropertyValueByName<T>(Object, String, out T)
ReflectionUtils.GetPropertyValueByName<T>(Object, String)
ReflectionUtils.SetPropertyByName(Object, String, Object)
ReflectionUtils.GetStructPropertyByName<T>(Object, String)
ReflectionUtils.GetStringPropertyByName(Object, String)
ReflectionUtils.ZipByProperty<T>(Object, Object, Object, Func<T, T, T>)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾