AffineThreadPool now uses standard semaphores in Windows builds; command line parser is satisfied with an IList of arguments instead of requiring a concrete List instance; added NCrunch XML file to svn:ignore list

git-svn-id: file:///srv/devel/repo-conversion/nusu@222 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2012-02-01 10:39:39 +00:00
parent 1a215987ac
commit 54d82e9659
4 changed files with 19 additions and 5 deletions

View File

@ -19,10 +19,10 @@ License along with this library
#endregion
using System;
using System.Threading;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
namespace Nuclex.Support {
@ -88,7 +88,11 @@ namespace Nuclex.Support {
// as we may run into situations where multiple operations need to be atomic.
// We keep track of the threads we've created just for good measure; not actually
// needed for any core functionality.
#if XBOX360
workAvailable = new Semaphore();
#else
workAvailable = new System.Threading.Semaphore(0, Processors);
#endif
userWorkItems = new Queue<UserWorkItem>(Processors * 4);
workerThreads = new List<Thread>(Processors);
inUseThreads = 0;
@ -299,7 +303,11 @@ namespace Nuclex.Support {
/// <summary>
/// Used to let the threads in the thread pool wait for new work to appear.
/// </summary>
#if XBOX360
private static Semaphore workAvailable;
#else
private static System.Threading.Semaphore workAvailable;
#endif
/// <summary>List of all worker threads at the disposal of the thread pool.</summary>
private static List<Thread> workerThreads;
/// <summary>Number of threads currently active.</summary>

View File

@ -99,13 +99,13 @@ namespace Nuclex.Support.Parsing {
/// <summary>Initializes a new command line</summary>
/// <param name="argumentList">List containing the parsed arguments</param>
private CommandLine(List<Argument> argumentList) :
private CommandLine(IList<Argument> argumentList) :
this(argumentList, WindowsModeDefault) { }
/// <summary>Initializes a new command line</summary>
/// <param name="argumentList">List containing the parsed arguments</param>
/// <param name="windowsMode">Whether the / character initiates an argument</param>
private CommandLine(List<Argument> argumentList, bool windowsMode) {
private CommandLine(IList<Argument> argumentList, bool windowsMode) {
this.arguments = argumentList;
this.windowsMode = windowsMode;
}
@ -298,7 +298,7 @@ namespace Nuclex.Support.Parsing {
}
/// <summary>Options that were specified on the command line</summary>
private List<Argument> arguments;
private IList<Argument> arguments;
/// <summary>Whether the / character initiates an argument</summary>
private bool windowsMode;

View File

@ -29,7 +29,10 @@ using NUnit.Framework;
namespace Nuclex.Support {
/// <summary>Unit Test for the Semaphore class</summary>
[TestFixture]
[
TestFixture,
Obsolete("Not obsolete, but prevents warning when using custom Semaphore on Windows")
]
public class SemaphoreTest {
/// <summary>

View File

@ -56,6 +56,9 @@ namespace Nuclex.Support {
/// become eligible for execution.
/// </para>
/// </remarks>
#if !XBOX360
[Obsolete("Prefer the normal semaphore on Windows builds.")]
#endif
public class Semaphore : WaitHandle {
/// <summary>Initializes a new semaphore</summary>