10[DebuggerDisplay(
"Count = {Count}")]
19 private volatile T[]
_array =
new T[32];
21 private volatile int _mask = 31;
60 if (num ==
int.MaxValue)
84 T[]
array =
new T[_array.Length << 1];
268 object IEnumerator.Current
292 _index = _array.Length + 1;
341 num =
checked(num + workStealingQueue.DangerousCount);
369 if (!workStealingQueue.IsEmpty)
383 bool ICollection.IsSynchronized =>
false;
385 object ICollection.SyncRoot
448 if (workStealingQueue ==
null)
456 return workStealingQueue;
465 if (workStealingQueue ==
null)
469 _locals.Value = workStealingQueue;
470 return workStealingQueue;
481 return workStealingQueue;
536 if (workStealingQueue.TrySteal(
out result,
take))
588 num += workStealingQueue.DangerousCopyTo(
array, num);
628 return Array.Empty<T>();
653 while (workStealingQueue.TrySteal(
out result,
take:
true))
705 if (workStealingQueue._frozen)
707 workStealingQueue._frozen =
false;
static unsafe void Clear(Array array)
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
static CDSCollectionETWBCLProvider Log
int DangerousCopyTo(T[] array, int arrayIndex)
void LocalPush(T item, ref long emptyToNonEmptyListTransitionCount)
bool TryLocalPop([MaybeNullWhen(false)] out T result)
bool TryLocalPeek([MaybeNullWhen(false)] out T result)
WorkStealingQueue(WorkStealingQueue nextQueue)
bool TrySteal([MaybeNullWhen(false)] out T result, bool take)
readonly WorkStealingQueue _nextQueue
readonly int _ownerThreadId
WorkStealingQueue CreateWorkStealingQueueForCurrentThread()
IEnumerator< T > GetEnumerator()
void CopyTo(T[] array, int index)
long _emptyToNonEmptyListTransitionCount
bool TryTake([MaybeNullWhen(false)] out T result)
void UnfreezeBag(bool lockTaken)
void FreezeBag(ref bool lockTaken)
WorkStealingQueue GetCurrentThreadWorkStealingQueue(bool forceCreate)
int CopyFromEachQueueToArray(T[] array, int index)
bool TryPeek([MaybeNullWhen(false)] out T result)
bool TryStealFromTo(WorkStealingQueue startInclusive, WorkStealingQueue endExclusive, [MaybeNullWhen(false)] out T result, bool take)
ConcurrentBag(IEnumerable< T > collection)
bool TrySteal([MaybeNullWhen(false)] out T result, bool take)
volatile WorkStealingQueue _workStealingQueues
WorkStealingQueue GetUnownedWorkStealingQueue()
readonly ThreadLocal< WorkStealingQueue > _locals
bool TryAdd(TKey key, TValue value)
static int CurrentManagedThreadId
static string ConcurrentBag_CopyTo_ArgumentNullException
static string ConcurrentCollection_SyncRoot_NotSupported
static string ConcurrentBag_Ctor_ArgumentNullException
static string ConcurrentBag_Enumerator_EnumerationNotStartedOrAlreadyFinished
static string Collection_CopyTo_TooManyElems
static string Collection_CopyTo_ArgumentOutOfRangeException
static int Exchange(ref int location1, int value)
static long Read(ref long location)
static int Increment(ref int location)
static void MemoryBarrier()
static void Exit(object obj)
static void Enter(object obj)
void CopyTo(Array array, int index)
IEnumerator GetEnumerator()