LogentriesCore.Net.AsyncLogger.AreAllQueuesEmpty C# (CSharp) Method

AreAllQueuesEmpty() public static method

Determines if the queue is empty after waiting the specified waitTime. Returns true or false if the underlying queues are empty.
public static AreAllQueuesEmpty ( System.TimeSpan waitTime ) : bool
waitTime System.TimeSpan The length of time the method should block before giving up waiting for it to empty.
return bool
        public static bool AreAllQueuesEmpty(TimeSpan waitTime)
        {
            var start = DateTime.UtcNow;
            var then = DateTime.UtcNow;

            while (start.Add(waitTime) > then)
            {
                if (_allQueues.All(x => x.Count == 0))
                    return true;

                Thread.Sleep(100);
                then = DateTime.UtcNow;
            }

            return _allQueues.All(x => x.Count == 0);
        }
        #endregion