예제 #1
0
파일: Program.cs 프로젝트: su636/voxeliq
        static TimeSpan MeasureNativeThreadPool(string[] feedSources)
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();

            var threadPoolDoneEvents = new ManualResetEvent[feedSources.Length];

            for (int i = 0; i < feedSources.Length; i++)
            {
                threadPoolDoneEvents[i] = new ManualResetEvent(false);
                var wrapper = new ThreadPoolDataWrapper(threadPoolDoneEvents[i], feedSources[i]);
                ThreadPool.QueueUserWorkItem(ThreadPoolTask, wrapper);
            }

            WaitHandle.WaitAll(threadPoolDoneEvents);

            stopwatch.Stop();
            return(stopwatch.Elapsed);
        }
예제 #2
0
        static TimeSpan MeasureNativeThreadPool(string[] feedSources)
        {
            var stopwatch = new Stopwatch();
            stopwatch.Start();

            var threadPoolDoneEvents = new ManualResetEvent[feedSources.Length];

            for (int i = 0; i < feedSources.Length; i++)
            {
                threadPoolDoneEvents[i] = new ManualResetEvent(false);
                var wrapper = new ThreadPoolDataWrapper(threadPoolDoneEvents[i], feedSources[i]);
                ThreadPool.QueueUserWorkItem(ThreadPoolTask, wrapper);
            }

            WaitHandle.WaitAll(threadPoolDoneEvents);

            stopwatch.Stop();
            return stopwatch.Elapsed;
        }