Changed TryPeek to handle race condition with Dequeue.
authormarcos henrich <marcoshenrich@gmail.com>
Fri, 30 May 2014 19:31:47 +0000 (20:31 +0100)
committermarcos henrich <marcoshenrich@gmail.com>
Fri, 30 May 2014 19:31:47 +0000 (20:31 +0100)
commit4449269d8fa64d0bdb09908ae28a8cc020989326
treed9bfbb6f51293263f96aa7fe2da482ea6504670b
parent02aacdb39e8303db5dc23690257514895325c1a9
Changed TryPeek to handle race condition with Dequeue.
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.
mcs/class/corlib/System.Collections.Concurrent/ConcurrentQueue.cs