AdvancedMultithreadingLab.TestSystemConcurrentQueue.ConsumeItems C# (CSharp) Method

ConsumeItems() protected method

protected ConsumeItems ( int count ) : void
count int
return void
        protected override void ConsumeItems( int count )
        {
            SpinWait spinWait = new SpinWait();
            int value;

            for ( int i = 0; i < count; )
            {
                if ( this.queue.TryDequeue( out value ) )
                {
                    i++;

                    spinWait.Reset();
                }
                else
                {
                    spinWait.SpinOnce();
                }
            }
        }
TestSystemConcurrentQueue