Пример #1
0
        public void Run(TestConfig config)
        {
            int count = config.Count;
            var res = new TestConcurResult();
            config.Result = res;

            TestConcur.nElements = count;
            var start = DateTime.Now;

            db = config.GetDatabase();
            L2List list = (L2List)db.Root;
            Tests.Assert(list == null);
            list = new L2List();
            list.head = new L2Elem();
            list.head.next = list.head.prev = list.head;
            db.Root = list;
            for (int i = 1; i < nElements; i++)
            {
                L2Elem elem = new L2Elem();
                elem.count = i;
                elem.linkAfter(list.head);
            }
            res.InsertTime = DateTime.Now - start;

            start = DateTime.Now;
            Thread[] threads = new Thread[nThreads];
            for (int i = 0; i < nThreads; i++)
            {
                threads[i] = new Thread(new ThreadStart(run));
                threads[i].Start();
            }
            #if !CF
            for (int i = 0; i < nThreads; i++)
            {
                threads[i].Join();
            }
            #endif
            db.Close();
            res.AccessTime = DateTime.Now - start;
        }