Class FixedSizeConcurrentLinkedListUtil
- Namespace
- Hi.Common.Collections
- Assembly
- HiGeom.dll
Utility of Fixed Size Concurrent LinkedList.
public static class FixedSizeConcurrentLinkedListUtil
- Inheritance
-
FixedSizeConcurrentLinkedListUtil
- Inherited Members
Methods
GetThreadSafeEnumerable<T>(LinkedList<T>, object)
Gets a thread-safe enumerable from the linked list by creating a copy of the list under a lock.
public static IEnumerable<T> GetThreadSafeEnumerable<T>(this LinkedList<T> delegatorLinkedList, object locker = null)
Parameters
delegatorLinkedListLinkedList<T>The source linked list.
lockerobjectThe object to use as a lock for synchronization. If null, the linked list itself will be used as the lock object.
Returns
- IEnumerable<T>
A thread-safe enumerable of the elements in the linked list.
Type Parameters
TThe type of elements in the linked list.
ThreadSafeEnqueue<T>(LinkedList<T>, T, int, object)
Enqueue data to delegatorLinkedList synchronizely.
A null data is dropped, which is why T is
constrained to reference types: for a value type the null test could never be true
and the drop rule would silently mean nothing.
public static void ThreadSafeEnqueue<T>(this LinkedList<T> delegatorLinkedList, T data, int bufferCapacity, object locker = null) where T : class
Parameters
delegatorLinkedListLinkedList<T>dataTbufferCapacityintif capacity smaller or equal to zero. The capacity is assume infinity.
lockerobjectlockeris locker fordelegatorLinkedListsynchronization. if null, applydelegatorLinkedListas locker.
Type Parameters
TThe element type; a reference type, so that “null is dropped” is a real rule.