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); }
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; }