Exemplo n.º 1
0
        public void MTStartContainer()
        {
            var input = new List <int>();

            input.AddRange(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
            var output = MT.Start <int, int>(input, 16, typeof(MTContainer), null);
        }
Exemplo n.º 2
0
        static void ProcessMultiThreadNew()
        {
            /*
             * PURPOSE: start a process in multi-threads.
             * */

            // initialize the input
            List <int>     mainInput  = GenerateInput(25000);
            List <decimal> mainOutput = null;

            mainOutput = MT.Start <int, decimal>(mainInput, 16, typeof(MTContainer), null);

            // do whatever is necessarily...
            for (int i = 0; i < mainInput.Count; i++)
            {
                int     a = mainInput[i];
                decimal b = mainOutput[i];

                // verify output...
                if (a == b + 1)
                {
                    throw new ApplicationException("not expected");
                }
                //Console.WriteLine("#{0}: {1} --> {2}", i, mainInput[i], mainOutput[i]);
            }

            Console.WriteLine("Press ENTER to continue...");
            Console.ReadLine();
        }
Exemplo n.º 3
0
        public void MTStartCallback()
        {
            var input = new List <int>();

            input.AddRange(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
            var output = MT.Start <int, int>(input, 16, (e) =>
            {
                e.Result = e.Input * 10;
            });
        }