/// <summary> /// Disposes of or finalises the object. /// </summary> /// <param name="disposing"></param> protected virtual void Dispose(bool disposing) { if (disposing) { QueueRepository.RemoveQueue(this); if (_BackgroundThread != null) { _BackgroundThread.Abort(); _BackgroundThread = null; } } }
/// <summary> /// Creates the object that displays the number of entries in the cached methods dictionary in the diagnostics /// queue display. /// </summary> private static void AddCacheCountToQueuesDisplay() { if (_QueueReporter == null) { lock (_CachedMethodsLock) { if (_QueueReporter == null) { _QueueReporter = new QueueReporter(); QueueRepository.AddQueue(_QueueReporter); } } } }
/// <summary> /// Creates a new object. /// </summary> /// <param name="queueName"></param> /// <param name="mechanism"></param> /// <param name="maxQueuedItems"></param> public BackgroundThreadQueue(string queueName, BackgroundThreadQueueMechanism mechanism, int maxQueuedItems = int.MaxValue) { var runtimeEnvironment = Factory.ResolveSingleton <IRuntimeEnvironment>(); if (mechanism == BackgroundThreadQueueMechanism.QueueWithNoBlock) { if (runtimeEnvironment.IsMono) { mechanism = BackgroundThreadQueueMechanism.Queue; } } if (runtimeEnvironment.IsTest) { mechanism = BackgroundThreadQueueMechanism.SingleThread; } _QueueName = queueName; _Mechanism = mechanism; MaxQueuedItems = maxQueuedItems; QueueRepository.AddQueue(this); }