示例#1
0
        public void TestAsyncProcessorEvents()
        {
            _jobCount = 0;
            AsyncProcessor proc = new AsyncProcessor(false);

            using ( proc )
            {
                proc.ThreadStarted     += new EventHandler(proc_ThreadStarted);
                proc.ThreadStarted     += new EventHandler(proc_ThreadStarted1);
                proc.ThreadStarted     += new EventHandler(proc_ThreadStarted2);
                proc.ThreadFinished    += new EventHandler(proc_ThreadStarted);
                proc.ThreadFinished    += new EventHandler(proc_ThreadStarted1);
                proc.FillingEmptyQueue += new EventHandler(proc_FillingEmptyQueue);
                proc.QueueGotEmpty     += new EventHandler(proc_QueueGotEmpty);
                proc.QueueGotEmpty     += new EventHandler(proc_QueueGotEmpty1);
                proc.JobStarting       += new EventHandler(proc_JobStarting);
                proc.JobFinished       += new EventHandler(proc_JobFinished);
                proc.JobQueued         += new JetBrains.Omea.AsyncProcessing.AsyncProcessor.JobDelegate(proc_JobQueued);
                proc.QueueJob(new SleepJob(0));
                proc.QueueJob(new SleepJob(0));
                proc.QueueJob(new SleepJob(0));
                proc.QueueJob(new SleepJob(0));
                proc.QueueEndOfWork();
                proc.EmployCurrentThread();
            }
            if (_jobCount != 0)
            {
                throw new Exception("TestAsyncProcessorEvents() failed. _jobCount = " + _jobCount);
            }
        }
示例#2
0
        public void TestEmployCurrentThread()
        {
            _jobCount = 0;
            AsyncProcessor proc = new AsyncProcessor(false);

            using ( proc )
            {
                proc.QueueJob(new SleepJob(0));
                proc.QueueJob(new SleepJob(0));
                proc.QueueJob(new SleepJob(0));
                proc.QueueEndOfWork();
                proc.EmployCurrentThread();
            }
            if (_jobCount != 3)
            {
                throw new Exception("TestEmployCurrentThread() failed. _jobCount = " + _jobCount);
            }
        }