From e21ac8b3c40665449e8dc1bbc5647b93c1a59f6c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 17 Nov 2016 20:59:13 +0000 Subject: [PATCH] counting issus safeguard --- OpenSim/Framework/LocklessQueue.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/LocklessQueue.cs b/OpenSim/Framework/LocklessQueue.cs index 9bd9baf321..7ccbba7b55 100644 --- a/OpenSim/Framework/LocklessQueue.cs +++ b/OpenSim/Framework/LocklessQueue.cs @@ -93,7 +93,10 @@ namespace OpenSim.Framework if (oldHead == oldTail) { if (oldHeadNext == null) + { + count = 0; return false; + } CAS(ref tail, oldTail, oldHeadNext); } @@ -118,8 +121,7 @@ namespace OpenSim.Framework { // ugly T item; - while(count > 0) - Dequeue(out item); + while(Dequeue(out item)); Init(); }