Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Rewrite ConcurrentQueue for better performance
This commit rewrites ConcurrentQueue<T> to provide better throughput and a much better allocation profile.  As with the previous implementation, it's structured as a linked list of segments.  Unlike the previous implementation, these segments are now ring buffers, allowing them to be reused as long as they're not full; if an enqueue does make a segment full, then a new segment is created for subsequent enqueues.  Also unlike the previous implementation, segments are dynamic in size, so newly allocated segments follow a doubling scheme similar to that employed by other generic collections.  The synchronization mechanism used is also lower-overhead than before, with a typical operation incurring just one CAS operation to either enqueue or dequeue.
  • Loading branch information
stephentoub committed Dec 8, 2016
commit 07bc2d89fd91ca46f7094662dcde114375b830f4
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
<data name="ConcurrentBag_CopyTo_ArgumentNullException" xml:space="preserve">
<value>The array argument is null.</value>
</data>
<data name="ConcurrentBag_CopyTo_ArgumentOutOfRangeException" xml:space="preserve">
<data name="Collection_CopyTo_ArgumentOutOfRangeException" xml:space="preserve">
<value>The index argument must be greater than or equal zero.</value>
</data>
<data name="ConcurrentCollection_SyncRoot_NotSupported" xml:space="preserve">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public void CopyTo(T[] array, int index)
}
if (index < 0)
{
throw new ArgumentOutOfRangeException(nameof(index), SR.ConcurrentBag_CopyTo_ArgumentOutOfRangeException);
throw new ArgumentOutOfRangeException(nameof(index), SR.Collection_CopyTo_ArgumentOutOfRangeException);
}

// Short path if the bag is empty
Expand Down
Loading