public void Clear() { lock (m_objLock) { m_msgQueue.Clear(); GotNewMessageEvent.Reset(); } }
private T[] PopAllMessages() { List <T> msglist = new List <T>(); lock (m_objLock) { while (m_msgQueue.Count > 0) { msglist.Add(m_msgQueue.Dequeue()); } if (m_msgQueue.Count <= 0) /// No more messages { GotNewMessageEvent.Reset(); } } return(msglist.ToArray()); }
private T PopNextMessage() { T msgret = default(T); lock (m_objLock) { if (m_msgQueue.Count > 0) { msgret = m_msgQueue.Dequeue(); } if (m_msgQueue.Count <= 0) /// No more messages { GotNewMessageEvent.Reset(); } } return(msgret); }