[corlib] Fix a edge case of ConcurrentQueue dequeuing by retrying after we fix up...
authorJeremie Laval <jeremie.laval@gmail.com>
Tue, 25 Sep 2012 13:24:56 +0000 (14:24 +0100)
committerJeremie Laval <jeremie.laval@gmail.com>
Tue, 25 Sep 2012 13:26:32 +0000 (14:26 +0100)
mcs/class/corlib/System.Collections.Concurrent/ConcurrentQueue.cs

index 381c6985ba3d51ea188aef78952e7bdcccad59cc..2c115e70cba08b15847a4f22e8b1ad3d1bfdc486 100644 (file)
@@ -106,11 +106,12 @@ namespace System.Collections.Concurrent
                                
                                if (oldHead == head) {
                                        // Empty case ?
-                                       if (oldHead == oldTail) {       
+                                       if (oldHead == oldTail) {
                                                // This should be false then
                                                if (oldNext != null) {
                                                        // If not then the linked list is mal formed, update tail
                                                        Interlocked.CompareExchange (ref tail, oldNext, oldTail);
+                                                       continue;
                                                }
                                                result = default (T);
                                                return false;