public virtual bool TryDequeue(out ITask task)
{
if (!CheckDispose () || suspended) {
task = null;
return false;
}
lock (_lock) {
if (queue.Count == 0) {
task = null;
return false;
}
task = queue.First.Value;
queue.RemoveFirst ();
if (waitingProducers > 0)
Monitor.Pulse (_lock);
return true;
}
}