diff options
Diffstat (limited to 'src/mscorlib/src/System/Threading/Tasks/ProducerConsumerQueues.cs')
-rw-r--r-- | src/mscorlib/src/System/Threading/Tasks/ProducerConsumerQueues.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mscorlib/src/System/Threading/Tasks/ProducerConsumerQueues.cs b/src/mscorlib/src/System/Threading/Tasks/ProducerConsumerQueues.cs index 462ee0a9bd..6b9dfbbe37 100644 --- a/src/mscorlib/src/System/Threading/Tasks/ProducerConsumerQueues.cs +++ b/src/mscorlib/src/System/Threading/Tasks/ProducerConsumerQueues.cs @@ -140,10 +140,10 @@ namespace System.Threading.Tasks internal SingleProducerSingleConsumerQueue() { // Validate constants in ctor rather than in an explicit cctor that would cause perf degradation - Contract.Assert(INIT_SEGMENT_SIZE > 0, "Initial segment size must be > 0."); - Contract.Assert((INIT_SEGMENT_SIZE & (INIT_SEGMENT_SIZE - 1)) == 0, "Initial segment size must be a power of 2"); - Contract.Assert(INIT_SEGMENT_SIZE <= MAX_SEGMENT_SIZE, "Initial segment size should be <= maximum."); - Contract.Assert(MAX_SEGMENT_SIZE < Int32.MaxValue / 2, "Max segment size * 2 must be < Int32.MaxValue, or else overflow could occur."); + Debug.Assert(INIT_SEGMENT_SIZE > 0, "Initial segment size must be > 0."); + Debug.Assert((INIT_SEGMENT_SIZE & (INIT_SEGMENT_SIZE - 1)) == 0, "Initial segment size must be a power of 2"); + Debug.Assert(INIT_SEGMENT_SIZE <= MAX_SEGMENT_SIZE, "Initial segment size should be <= maximum."); + Debug.Assert(MAX_SEGMENT_SIZE < Int32.MaxValue / 2, "Max segment size * 2 must be < Int32.MaxValue, or else overflow could occur."); // Initialize the queue m_head = m_tail = new Segment(INIT_SEGMENT_SIZE); @@ -183,7 +183,7 @@ namespace System.Threading.Tasks } int newSegmentSize = m_tail.m_array.Length << 1; // double size - Contract.Assert(newSegmentSize > 0, "The max size should always be small enough that we don't overflow."); + Debug.Assert(newSegmentSize > 0, "The max size should always be small enough that we don't overflow."); if (newSegmentSize > MAX_SEGMENT_SIZE) newSegmentSize = MAX_SEGMENT_SIZE; var newSegment = new Segment(newSegmentSize); @@ -456,7 +456,7 @@ namespace System.Threading.Tasks /// <remarks>The Count is not thread safe, so we need to acquire the lock.</remarks> int IProducerConsumerQueue<T>.GetCountSafe(object syncObj) { - Contract.Assert(syncObj != null, "The syncObj parameter is null."); + Debug.Assert(syncObj != null, "The syncObj parameter is null."); lock (syncObj) { return Count; |