Dequeue sets the head.Value to its default. When TryPeek is interrupted in the process of retrieving the value some times Dequeue sets the value to its default. TryPeek now checks the head has not been changed before returning the value.
- in the previous version the IsEmpty could be false, but by time we get
to head.Next.Value we get an exception since Value is now null
- passes existing test cases, although these are not definitive since
they don't show threading issue
- would need to adapt System.Threading.Tasks.ParallelTestHelper to allow
TryPeek() to be called during Enqueue/Dequeue operations to truly
test this change out
In class/corlib/:
* corlib.dll.sources: Add System.Threading.Tasks/SimpleConcurrentBag.cs
and System.Threading.Tasks/UnobservedTaskExceptionEventArgs.cs
In class/corlib/System.Collections.Concurrent/:
* ConcurrentDictionary.cs:
* ConcurrentQueue.cs:
* ConcurrentStack.cs:
* Partitioner.cs: Port to .NET 4 beta 2 API
* ConcurrentSkipList.cs: Use Monitor for locking
In class/corlib/System.Threading.Tasks/:
* Future.cs:
* Parallel.cs:
* ParallelLoopState.cs:
* Task.cs:
* TaskCompletionSource.cs:
* TaskContinuationOptions.cs:
* TaskCreationOptions.cs:
* TaskFactory.cs:
* TaskScheduler.cs:
* UnobservedTaskExceptionEventArgs.cs: Port to .NET 4 beta 2 API
* SimpleConcurrentBag.cs: Add a simpler implementation of ConcurrentBag
for use with parallel loops as ConcurrentBag was moved to System
In class/corlib/System.Threading/:
* CancellationToken.cs:
* CancellationTokenSource.cs:
* ManualResetEventSlim.cs:
* SemaphoreSlim.cs:
* SpinLock.cs:
* SpinWait.cs:
* ThreadLocal.cs: Port to .NET 4 beta 2 API
In class/corlib/System/:
* AggregateException.cs:
* OperationCanceledException.cs: Port to .NET 4 beta 2 API
In class/corlib/Test/System.Collections.Concurrent/:
* CollectionStressTestHelper.cs:
* ConcurrentBagTests.cs:
* ConcurrentDictionaryTests.cs:
* ConcurrentQueueTests.cs:
* ConcurrentSkipListTests.cs:
* ConcurrentStackTests.cs:
* ParallelConcurrentQueueTests.cs:
* ParallelConcurrentStackTests.cs: Update namespaces and tested methods
In class/corlib/Test/System.Threading.Tasks/:
* FutureTests.cs:
* ParallelTestHelper.cs:
* ParallelTests.cs:
* SnziTests.cs:
* TaskCompletionSourceTests.cs:
* TaskTest.cs: Update namespace and tested methods
In class/corlib/Test/System.Threading/:
* CancellationTokenTests.cs:
* LazyInitTests.cs:
* ThreadLazyTests.cs: Update namespace and tested methods
svn path=/trunk/mcs/; revision=150716