コード例 #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;
        }