예제 #1
0
        public void MainTest()
        {
            int threadsCount = 50;
            int processCount = 1000 * 1000;
            var woker        = new SingleThreadWorker(Do);

            // запускаем потоки
            var threads = new Thread[threadsCount];

            for (int i = 0; i < threadsCount; i++)
            {
                var thread = new Thread(() =>
                {
                    for (int j = 0; j < processCount; j++)
                    {
                        woker.TryStart();
                    }
                });
                thread.Start();
                threads[i] = thread;
            }

            // ждем выполнения всех потоков
            foreach (var thread in threads)
            {
                thread.Join();
            }
        }
예제 #2
0
 protected void TryBeginSaveChangesLoop()
 {
     _saveChangesLoopWorker.TryStart();
 }
예제 #3
0
 protected void TryBeginUnloadDataLoop()
 {
     _unloadDataLoopWorker.TryStart();
 }