C# Thread Sleep or Wait until there is work MUTEX or MONITOR
<p>I have a worker thread in my socket server. When I set to the lowest priority, everything works find but it is slow. When I set the priority to Normal, it is much faster but when there is not work and it is in a while loop checking for an item to be added to the queue list, it  still hogs up the cpu usuage and my VM slows down. I an new at thread management. How do I use a Mutex or Monitor to make the thread sleep or wait until there is work in the queue.  </p>

<pre><code>m_workerThread = new Thread(new ThreadStart(ProcessQueueLogs));
m_workerThread.Priority = ThreadPriority.Lowest;
m_workerThread.Start();

private void ProcessQueueLogs()
{
    try
    {
        while (!m_stopServer)
        {
            if (m_socketListenersList.Count &gt; 0)
            {
                //Logger.WiteLog("ltsserver getting socketlistener from queue");
                // get the first socket in the list
                LTSSocketListener workerSocket = RequestQueue(null, false);
                //LTSSocketListener workerSocket = (LTSSocketListener)m_socketListenersList[0];

                if (workerSocket != null)
                {
                    // start the socket to process the request
                    workerSocket.StartProcessingRequest();

                    // close the socket
                    workerSocket.CloseSocketListener();

                    //Logger.WriteLog("ltsserver closing socketlistener");

                    // remove of the socket queue list
                    RequestQueue(workerSocket, false);
                    //m_socketListenersList.Remove(workerSocket);
                }
            }
        }
    }
    catch (SocketException e)
    {
        EventLog.WriteEntry(m_eventSource, e.Message.ToString());
        EventLog.WriteEntry(m_eventSource, e.Message.ToString(),               EventLogEntryType.Error, 234);
    }
}
</code></pre>

<p>Any help is appreciated.</p>
