Пример #1
0
 /// <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);
             }
         }
     }
 }
Пример #2
0
        /// <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);
        }