diff --git a/Lidgren.Network/NetQueue.cs b/Lidgren.Network/NetQueue.cs index 475bc37..25a015b 100644 --- a/Lidgren.Network/NetQueue.cs +++ b/Lidgren.Network/NetQueue.cs @@ -56,12 +56,29 @@ namespace Lidgren.Network /// /// Gets the number of items in the queue /// - public int Count { get { return m_size; } } + public int Count { + get + { + m_lock.EnterReadLock(); + int count = m_size; + m_lock.ExitReadLock(); + return count; + } + } /// /// Gets the current capacity for the queue /// - public int Capacity { get { return m_items.Length; } } + public int Capacity + { + get + { + m_lock.EnterReadLock(); + int capacity = m_items.Length; + m_lock.ExitReadLock(); + return capacity; + } + } /// /// NetQueue constructor