private void Delay(byte delayLevel, List <Computation> computes, IEnumerable context)
        {
            delayLevel = Math.Max(delayLevel, currentOutputDelay);
            List <DelayedOutputCreation> list;

            if (delay == null)
            {
                delay = new List <List <DelayedOutputCreation> >();
            }
            if (delay.Count > delayLevel)
            {
                list = delay[delayLevel];
                if (list == null)
                {
                    list = new List <DelayedOutputCreation>();
                    delay[delayLevel] = list;
                }
            }
            else
            {
                while (delay.Count < delayLevel)
                {
                    delay.Add(null);
                }
                list = new List <DelayedOutputCreation>();
                delay.Add(list);
            }
            var output = new DelayedOutputCreation(computes, context);

            list.Add(output);
        }
 private void Delay(byte delayLevel, List<Computation> computes, IEnumerable context)
 {
     delayLevel = Math.Max(delayLevel, currentOutputDelay);
     ConcurrentQueue<DelayedOutputCreation> list;
     if (delay.Count > delayLevel)
     {
         list = delay[delayLevel];
         if (list == null)
         {
             lock (_delayLockObject)
             {
                 list = CreateDelayLevel(delayLevel);
             }
         }
     }
     else
     {
         lock (_delayLockObject)
         {
             if (delay.Count <= delayLevel)
             {
                 while (delay.Count < delayLevel)
                 {
                     delay.Add(null);
                 }
                 list = new ConcurrentQueue<DelayedOutputCreation>();
                 delay.Add(list);
             }
             else
             {
                 list = CreateDelayLevel(delayLevel);
             }
         }
     }
     var output = new DelayedOutputCreation(computes, context);
     list.Enqueue(output);
 }
Esempio n. 3
0
 private void Delay(byte delayLevel, List<Computation> computes, IEnumerable context)
 {
     delayLevel = Math.Max(delayLevel, currentOutputDelay);
     List<DelayedOutputCreation> list;
     if (delay == null) delay = new List<List<DelayedOutputCreation>>();
     if (delay.Count > delayLevel)
     {
         list = delay[delayLevel];
         if (list == null)
         {
             list = new List<DelayedOutputCreation>();
             delay[delayLevel] = list;
         }
     }
     else
     {
         while (delay.Count < delayLevel)
         {
             delay.Add(null);
         }
         list = new List<DelayedOutputCreation>();
         delay.Add(list);
     }
     var output = new DelayedOutputCreation(computes, context);
     list.Add(output);
 }