Ejemplo n.º 1
0
 protected override void Execute()
 {
     if (++_jobCount < 4)
     {
         _proc.QueueIdleJob(this);
     }
 }
Ejemplo n.º 2
0
        public void TestIdle()
        {
            Console.Out.WriteLine("Starting TestIdle()");
            AsyncProcessor processor = new AsyncProcessor(false);

            _jobCount = 0;
            using ( processor )
            {
                processor.IdlePeriod = 500;
                processor.StartThread();
                processor.QueueIdleJob(new TimedJob());
                processor.QueueIdleJob(new TimedJob());
                processor.QueueIdleJob(new TimedJob());
                processor.QueueIdleJob(new TimedJob());
                Thread.Sleep(1500);
            }
            if (_jobCount != 4)
            {
                throw new Exception("TestIdle() failed. _jobCount = " + _jobCount);
            }
        }