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
delegatorLinkedList
LinkedList<T>The source linked list.
locker
objectThe 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
T
The type of elements in the linked list.
ThreadSafeEnqueue<T>(LinkedList<T>, T, int, object)
Enqueue data
to delegatorLinkedList
synchronizely.
public static void ThreadSafeEnqueue<T>(this LinkedList<T> delegatorLinkedList, T data, int bufferCapacity, object locker = null)
Parameters
delegatorLinkedList
LinkedList<T>data
TbufferCapacity
intif capacity smaller or equal to zero. The capacity is assume infinity.
locker
objectlocker
is locker fordelegatorLinkedList
synchronization. if null, applydelegatorLinkedList
as locker.
Type Parameters
T