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;