C# FIFO Queue Like BLockingCollection without waiting
<p>I want to have a FIFO Queue with the following requirements:</p>

<ul>
<li>If queue is empty, wait for one element to be added</li>
<li>Start processing as soon as one element is in the Q</li>
<li>If elements pending in the Q are more than X, drop them.</li>
</ul>

<p>I used a <code>BlockingCollection</code> like this:</p>

<pre><code>public LoggerReal() 
{
    main = (frmMain)Application.OpenForms[0];
    LogQueue = new BlockingCollection&lt;logEntry&gt;(GlobalSettings.LogQueueSize);
    Task.Run(() =&gt; {
        foreach (logEntry LE in LogQueue.GetConsumingEnumerable()) {    
            try {
                ProcessLogEntry(LE);
            } catch (Exception E) {
                functions.Logger.log("Error processing logEntry" + E.Message, "LOGPROCESSING", LOGLEVEL.ERROR);
                functions.printException(E);
            }

        }
        functions.Logger.log("Exiting Queue Task", "LOGPROCESSING", LOGLEVEL.ERROR);
    });
}
</code></pre>

<p>However, I noticed that the logs seems to show only when the queue was full.
<code>ProcessLogEntry</code> function simply puts them into a <code>ListBox</code>.</p>

<p>I tried using simple queue with no luck.</p>

<p>As far as I could tell, ConcurrentQueue and other Queue might not fulfill these requirements, or am I wrong? I start the Queue processor into a Task so it can be waiting forever, that is not an issue, but it needs to start processing as soon as data is available.</p>