# HG changeset patch # User cin # Date 2015-01-27 15:18:29 # Node ID d86da8d2d4c3220c4663461b78bb9115af5f6bc0 # Parent f7b2b8bfbb8caec81c78ffdb06511332de041f96 fixed AsyncQueue iterator diff --git a/Implab/Implab.csproj b/Implab/Implab.csproj --- a/Implab/Implab.csproj +++ b/Implab/Implab.csproj @@ -7,8 +7,6 @@ Library Implab Implab - 8.0.30703 - 2.0 true diff --git a/Implab/Parallels/AsyncQueue.cs b/Implab/Parallels/AsyncQueue.cs --- a/Implab/Parallels/AsyncQueue.cs +++ b/Implab/Parallels/AsyncQueue.cs @@ -44,6 +44,10 @@ namespace Implab.Parallels { get { return m_hi; } } + public int Size { + get { return m_size; } + } + public bool TryEnqueue(T value, out bool extend) { var alloc = Interlocked.Increment(ref m_alloc) - 1; @@ -562,9 +566,15 @@ namespace Implab.Parallels { m_pos = m_current.Low; else m_pos++; + if (m_pos == m_current.Hi) { + + m_current = m_pos == m_current.Size ? m_current.next : null; + m_pos = 0; - m_current = m_current.next; + + if (m_current == null) + return false; } return true;