private WaitUntilFinished ( CoroutineInfo workerData ) : IEnumerator | ||
workerData | CoroutineInfo | |
리턴 | IEnumerator |
public void TestMultipleAsyncProcessors() { const int count = 300000; AsyncProcessor lockProcessor1 = new AsyncProcessor(false); AsyncProcessor lockProcessor2 = new AsyncProcessor(false); AsyncProcessor lockProcessor3 = new AsyncProcessor(false); AsyncProcessor lockProcessor4 = new AsyncProcessor(false); ArrayList lockJobs = new ArrayList(count); for (int i = 0; i < count; ++i) { lockJobs.Add(new LockJob()); } for (int i = 0; i < count; ++i) { lockProcessor1.QueueJob((AbstractJob)lockJobs[i]); lockProcessor2.QueueJob((AbstractJob)lockJobs[i]); lockProcessor3.QueueJob((AbstractJob)lockJobs[i]); lockProcessor4.QueueJob((AbstractJob)lockJobs[i]); } lockProcessor1.QueueEndOfWork(); lockProcessor2.QueueEndOfWork(); lockProcessor3.QueueEndOfWork(); lockProcessor4.QueueEndOfWork(); lockProcessor1.StartThread(); lockProcessor2.StartThread(); lockProcessor3.StartThread(); lockProcessor4.StartThread(); lockProcessor1.WaitUntilFinished(); lockProcessor2.WaitUntilFinished(); lockProcessor3.WaitUntilFinished(); lockProcessor4.WaitUntilFinished(); }
public void TestCancellation() { _jobCount = 0; AsyncProcessor processor = new AsyncProcessor(); using ( processor ) { TimedJob job = new TimedJob(); processor.QueueJobAt(DateTime.Now.AddSeconds(4), job); processor.QueueJobAt(DateTime.Now.AddSeconds(4.01), job); processor.CancelTimedJobs(job); processor.QueueEndOfWork(); processor.WaitUntilFinished(); if (_jobCount != -2) { throw new Exception("TestCancellation() failed. _jobCount = " + _jobCount); } } }
public void TestSpinWaitLock() { SpinWaitLock aLock = new SpinWaitLock(); AsyncProcessor proc1 = new AsyncProcessor(false); AsyncProcessor proc2 = new AsyncProcessor(false); using ( proc1 ) { using ( proc2 ) { for (int i = 0; i < 100000; ++i) { proc1.QueueJob(new SpinWaitLockJob(aLock)); proc2.QueueJob(new SpinWaitLockJob(aLock)); } proc1.StartThread(); proc2.StartThread(); proc1.QueueEndOfWork(); proc2.QueueEndOfWork(); proc1.WaitUntilFinished(); proc2.WaitUntilFinished(); } } }