From 273eb9885ce9c1174b97748ad33955eeb45965f3 Mon Sep 17 00:00:00 2001 From: Markus Ewald Date: Fri, 18 Sep 2009 20:38:55 +0000 Subject: [PATCH] AffineThreadPool.CpuCores is now called AffineThreadPool.Processors because this is the term used throughout the .NET framework for the same concept git-svn-id: file:///srv/devel/repo-conversion/nusu@178 d2e56fa2-650e-0410-a79f-9358c0239efd --- Source/AffineThreadPool.Test.cs | 2 +- Source/AffineThreadPool.cs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/AffineThreadPool.Test.cs b/Source/AffineThreadPool.Test.cs index 3c3964c..3080862 100644 --- a/Source/AffineThreadPool.Test.cs +++ b/Source/AffineThreadPool.Test.cs @@ -255,7 +255,7 @@ namespace Nuclex.Support { /// [Test] public void TestWaitingWorkItemsProperty() { - int eventCount = AffineThreadPool.CpuCores; + int eventCount = AffineThreadPool.Processors; WaitTask[] tasks = new WaitTask[eventCount]; int createdTasks = 0; diff --git a/Source/AffineThreadPool.cs b/Source/AffineThreadPool.cs index 79cfd48..f828f3f 100644 --- a/Source/AffineThreadPool.cs +++ b/Source/AffineThreadPool.cs @@ -44,9 +44,9 @@ namespace Nuclex.Support { /// Number of CPU cores available on the system #if XBOX360 - public static readonly int CpuCores = 4; + public static readonly int Processors = 4; #else - public static readonly int CpuCores = Environment.ProcessorCount; + public static readonly int Processors = Environment.ProcessorCount; #endif /// Delegate used by the thread pool to report unhandled exceptions @@ -83,8 +83,8 @@ namespace Nuclex.Support { // We keep track of the threads we've created just for good measure; not actually // needed for any core functionality. workAvailable = new Semaphore(); - userWorkItems = new Queue(CpuCores * 4); - workerThreads = new List(CpuCores); + userWorkItems = new Queue(Processors * 4); + workerThreads = new List(Processors); inUseThreads = 0; #if XBOX360 @@ -92,14 +92,14 @@ namespace Nuclex.Support { hardwareThreads = new Queue(new int[] { 5, 4, 3, 1 }); #else // We can use all cores in the PC, starting from index 1 - hardwareThreads = new Queue(CpuCores); - for(int core = CpuCores; core >= 1; --core) { + hardwareThreads = new Queue(Processors); + for(int core = Processors; core >= 1; --core) { hardwareThreads.Enqueue(core); } #endif // Create all of the worker threads - for(int index = 0; index < CpuCores; index++) { + for(int index = 0; index < Processors; index++) { // Create a new thread and add it to the list of threads. Thread newThread = new Thread(new ThreadStart(ProcessQueuedItems)); @@ -149,7 +149,7 @@ namespace Nuclex.Support { } /// Gets the number of threads at the disposal of the thread pool - public static int MaxThreads { get { return CpuCores; } } + public static int MaxThreads { get { return Processors; } } /// Gets the number of currently active threads in the thread pool public static int ActiveThreads { get { return inUseThreads; } }