Esempio n. 1
0
        int StartThread(long dueAt)
        {
            var threadNumber = threadCounter;
            var newThread    = new ProcessingThread(rampUpControllerFactory(RampUp), TryDequeue, _ => processedMessages++, s => AddEvent(threadNumber, s));
            var running      = new RunningThread(threadNumber, newThread.ReceiveLoop().GetEnumerator(), OnTheadDied, dueAt);

            threads.Add(running);
            threadCounter++;
            return(threadNumber);
        }
Esempio n. 2
0
 void OnTheadDied(RunningThread obj)
 {
     currentQueue.Add(() =>
     {
         threads.Remove(obj);
         //if (threads.Count == 0)
         //{
         //    StartThread(currentTime + 1);
         //}
         //else
         {
             AddEvent(obj.ThreadNumber, "Thread died");
         }
     });
 }
 int StartThread(long dueAt)
 {
     var threadNumber = threadCounter;
     var newThread = new ProcessingThread(rampUpControllerFactory(RampUp), TryDequeue, _ => processedMessages++, s => AddEvent(threadNumber, s));
     var running = new RunningThread(threadNumber, newThread.ReceiveLoop().GetEnumerator(), OnTheadDied, dueAt);
     threads.Add(running);
     threadCounter++;
     return threadNumber;
 }
 void OnTheadDied(RunningThread obj)
 {
     currentQueue.Add(() =>
     {
         threads.Remove(obj);
         //if (threads.Count == 0)
         //{
         //    StartThread(currentTime + 1);
         //}
         //else
         {
             AddEvent(obj.ThreadNumber, "Thread died");
         }
     });
 }