while循环消耗内存的有关问题
while循环消耗内存的问题
while (ThreadStatus.thread_running == m_status)
{
mMessage msg = null;
lock (m_queueLock)
{
if (t_msgQueue_high.Count > 0)
{
msg = t_msgQueue_high[0];
t_msgQueue_high.RemoveAt(0);
}
else if (t_msgQueue_Ordinary.Count > 0)
{
msg = t_msgQueue_Ordinary[0];
t_msgQueue_Ordinary.RemoveAt(0);
}
else if (t_msgQueue_low.Count > 0)
{
msg = t_msgQueue_low[0];
t_msgQueue_low.RemoveAt(0);
}
else
{
Thread.Sleep(1);
continue;
}
}
if (msg.mMessageID != mMessageEnum.event_stopAll)
{