Beispiel #1
0
        static Thread StartThread()
        {
            Thread th = new Thread(execute);

            th.Name = "Thread #" + ThreadCounter.Add();
            th.Start(code);

            return(th);
        }
Beispiel #2
0
        public void TestThreading()
        {
            for (int i = 0; i < 15; i++)
            {
                StartThread();
            }

            ThreadCounter.Wait();
        }
Beispiel #3
0
        static void execute(object code)
        {
            string codestring = (string)code;
            object rez        = Script.RunCode(codestring);

            Assert.AreEqual(255, rez);

            ThreadCounter.Dec();
        }