diff --git a/ICD.Common.Utils/Collections/ScrollQueue.cs b/ICD.Common.Utils/Collections/ScrollQueue.cs index e580c71..087eda4 100644 --- a/ICD.Common.Utils/Collections/ScrollQueue.cs +++ b/ICD.Common.Utils/Collections/ScrollQueue.cs @@ -2,7 +2,6 @@ using System.Collections; using System.Collections.Generic; using ICD.Common.Properties; -using ICD.Common.Utils.Extensions; namespace ICD.Common.Utils.Collections { @@ -16,8 +15,6 @@ namespace ICD.Common.Utils.Collections private readonly LinkedList m_Collection; private int m_MaxSize; - private readonly SafeCriticalSection m_CollectionLock; - #region Properties /// @@ -41,13 +38,13 @@ namespace ICD.Common.Utils.Collections /// /// Gets the number of items in the collection. /// - public int Count { get { return m_CollectionLock.Execute(() => m_Collection.Count); } } + public int Count { get { return m_Collection.Count; } } /// /// The IsSynchronized Boolean property returns True if the /// collection is designed to be thread safe; otherwise, it returns False. /// - public bool IsSynchronized { get { return true; } } + public bool IsSynchronized { get { return false; } } /// /// The SyncRoot property returns an object, which is used for synchronizing @@ -64,7 +61,6 @@ namespace ICD.Common.Utils.Collections /// public ScrollQueue(int maxSize) { - m_CollectionLock = new SafeCriticalSection(); m_Collection = new LinkedList(); MaxSize = maxSize; } @@ -76,7 +72,7 @@ namespace ICD.Common.Utils.Collections /// public void Clear() { - m_CollectionLock.Execute(() => m_Collection.Clear()); + m_Collection.Clear(); } /// @@ -86,17 +82,8 @@ namespace ICD.Common.Utils.Collections [PublicAPI] public void Enqueue(TContents item) { - m_CollectionLock.Enter(); - - try - { - m_Collection.AddLast(item); - Trim(); - } - finally - { - m_CollectionLock.Leave(); - } + m_Collection.AddLast(item); + Trim(); } /// @@ -106,18 +93,9 @@ namespace ICD.Common.Utils.Collections [PublicAPI] public TContents Dequeue() { - m_CollectionLock.Enter(); - - try - { - TContents output = m_Collection.First.Value; - m_Collection.RemoveFirst(); - return output; - } - finally - { - m_CollectionLock.Leave(); - } + TContents output = Peek(); + m_Collection.RemoveFirst(); + return output; } /// @@ -127,7 +105,7 @@ namespace ICD.Common.Utils.Collections [PublicAPI] public TContents Peek() { - return m_CollectionLock.Execute(() => m_Collection.First.Value); + return m_Collection.First.Value; } #endregion @@ -141,24 +119,15 @@ namespace ICD.Common.Utils.Collections public IEnumerator GetEnumerator() { - return m_CollectionLock.Execute(() => m_Collection.ToList(Count).GetEnumerator()); + return m_Collection.GetEnumerator(); } void ICollection.CopyTo(Array myArr, int index) { - m_CollectionLock.Enter(); - - try + foreach (TContents item in m_Collection) { - foreach (TContents item in m_Collection) - { - myArr.SetValue(item, index); - index++; - } - } - finally - { - m_CollectionLock.Leave(); + myArr.SetValue(item, index); + index++; } } @@ -171,17 +140,8 @@ namespace ICD.Common.Utils.Collections /// private void Trim() { - m_CollectionLock.Enter(); - - try - { - while (Count > MaxSize) - m_Collection.RemoveFirst(); - } - finally - { - m_CollectionLock.Leave(); - } + while (Count > MaxSize) + m_Collection.RemoveFirst(); } #endregion