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