Assembly is now signed with a strong name key; minor cosmetic improvements

git-svn-id: file:///srv/devel/repo-conversion/nusu@213 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2011-02-14 18:15:23 +00:00
parent eafb9e442b
commit da61476a80
5 changed files with 56 additions and 20 deletions

View File

@ -33,6 +33,12 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<DocumentationFile>bin\net-4.0\Release\Nuclex.Support.xml</DocumentationFile> <DocumentationFile>bin\net-4.0\Release\Nuclex.Support.xml</DocumentationFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\Foundation.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="NMock2"> <Reference Include="NMock2">
<HintPath>..\References\nmock\net-4.0\NMock2.dll</HintPath> <HintPath>..\References\nmock\net-4.0\NMock2.dll</HintPath>
@ -366,6 +372,11 @@
<DependentUpon>XmlHelper.cs</DependentUpon> <DependentUpon>XmlHelper.cs</DependentUpon>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="..\Foundation.snk">
<Link>Foundation.snk</Link>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -42,6 +42,12 @@
<XnaCompressContent>false</XnaCompressContent> <XnaCompressContent>false</XnaCompressContent>
<DocumentationFile>bin\xna-4.0-phone7\Release\Nuclex.Support.xml</DocumentationFile> <DocumentationFile>bin\xna-4.0-phone7\Release\Nuclex.Support.xml</DocumentationFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\Foundation.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.Phone, Version=7.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e, processorArchitecture=MSIL" /> <Reference Include="Microsoft.Phone, Version=7.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e, processorArchitecture=MSIL" />
<Reference Include="Microsoft.Xna.Framework"> <Reference Include="Microsoft.Xna.Framework">
@ -397,6 +403,11 @@
<DependentUpon>XmlHelper.cs</DependentUpon> <DependentUpon>XmlHelper.cs</DependentUpon>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="..\Foundation.snk">
<Link>Foundation.snk</Link>
</None>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" /> <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" />
<!-- <!--

View File

@ -42,6 +42,12 @@
<XnaCompressContent>true</XnaCompressContent> <XnaCompressContent>true</XnaCompressContent>
<DocumentationFile>bin\xna-4.0-xbox360\Release\Nuclex.Support.xml</DocumentationFile> <DocumentationFile>bin\xna-4.0-xbox360\Release\Nuclex.Support.xml</DocumentationFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\Foundation.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.Xna.Framework"> <Reference Include="Microsoft.Xna.Framework">
<Private>False</Private> <Private>False</Private>
@ -413,6 +419,11 @@
<Content Include="Documents\Nuclex.Support.txt" /> <Content Include="Documents\Nuclex.Support.txt" />
<Content Include="Documents\Request Framework.txt" /> <Content Include="Documents\Request Framework.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="..\Foundation.snk">
<Link>Foundation.snk</Link>
</None>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" /> <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" />
<!-- <!--

View File

@ -32,7 +32,7 @@ namespace Nuclex.Support {
/// Unlike the normal thread pool, the affine thread pool provides only as many /// Unlike the normal thread pool, the affine thread pool provides only as many
/// threads as there are CPU cores available on the current platform. This makes /// threads as there are CPU cores available on the current platform. This makes
/// it more suitable for tasks you want to spread across all available cpu cores /// it more suitable for tasks you want to spread across all available cpu cores
/// explicitely. /// explicitly.
/// </para> /// </para>
/// <para> /// <para>
/// However, it's not a good match if you want to run blocking or waiting tasks /// However, it's not a good match if you want to run blocking or waiting tasks
@ -97,7 +97,7 @@ namespace Nuclex.Support {
// We can only use these hardware thread indices on the XBox 360 // We can only use these hardware thread indices on the XBox 360
hardwareThreads = new Queue<int>(new int[] { 5, 4, 3, 1 }); hardwareThreads = new Queue<int>(new int[] { 5, 4, 3, 1 });
#else #else
// We can use all cores in the PC, starting from index 1 // We can use all cores on a PC, starting from index 1
hardwareThreads = new Queue<int>(Processors); hardwareThreads = new Queue<int>(Processors);
for(int core = Processors; core >= 1; --core) { for(int core = Processors; core >= 1; --core) {
hardwareThreads.Enqueue(core); hardwareThreads.Enqueue(core);
@ -179,6 +179,21 @@ namespace Nuclex.Support {
throw exception; throw exception;
} }
#if WINDOWS
/// <summary>Retrieves the ProcessThread for the calling thread</summary>
/// <returns>The ProcessThread for the calling thread</returns>
internal static ProcessThread GetProcessThread(int threadId) {
ProcessThreadCollection threads = Process.GetCurrentProcess().Threads;
for(int index = 0; index < threads.Count; ++index) {
if(threads[index].Id == threadId) {
return threads[index];
}
}
return null;
}
#endif
/// <summary>A thread worker function that processes items from the work queue</summary> /// <summary>A thread worker function that processes items from the work queue</summary>
private static void ProcessQueuedItems() { private static void ProcessQueuedItems() {
@ -221,8 +236,8 @@ namespace Nuclex.Support {
// Execute the work item we just picked up. Make sure to accurately // Execute the work item we just picked up. Make sure to accurately
// record how many callbacks are currently executing. // record how many callbacks are currently executing.
try {
Interlocked.Increment(ref inUseThreads); Interlocked.Increment(ref inUseThreads);
try {
workItem.Callback(workItem.State); workItem.Callback(workItem.State);
} }
catch(Exception exception) { // Make sure we don't throw here. catch(Exception exception) { // Make sure we don't throw here.
@ -237,21 +252,6 @@ namespace Nuclex.Support {
} }
} }
#if WINDOWS
/// <summary>Retrieves the ProcessThread for the calling thread</summary>
/// <returns>The ProcessThread for the calling thread</returns>
internal static ProcessThread GetProcessThread(int threadId) {
ProcessThreadCollection threads = Process.GetCurrentProcess().Threads;
for(int index = 0; index < threads.Count; ++index) {
if(threads[index].Id == threadId) {
return threads[index];
}
}
return null;
}
#endif
/// <summary>Obtains the next work item from the queue</summary> /// <summary>Obtains the next work item from the queue</summary>
/// <returns>The next work item in the queue</returns> /// <returns>The next work item in the queue</returns>
/// <remarks> /// <remarks>
@ -272,7 +272,10 @@ namespace Nuclex.Support {
} }
} }
// If we can't get one, go to sleep. // If we can't get one, go to sleep. The semaphore blocks until work
// becomes available (then acting like an AutoResetEvent that counts
// how often it has been triggered and letting that number of threads
// pass through.)
workAvailable.WaitOne(); workAvailable.WaitOne();
} }

View File

@ -150,7 +150,7 @@ namespace Nuclex.Support {
// resource to become available. // resource to become available.
if(newFree >= 0) { if(newFree >= 0) {
#if NO_EXITCONTEXT #if NO_EXITCONTEXT
if (!this.manualResetEvent.WaitOne(millisecondsTimeout)) { if(!this.manualResetEvent.WaitOne(millisecondsTimeout)) {
#else #else
if(!this.manualResetEvent.WaitOne(millisecondsTimeout, exitContext)) { if(!this.manualResetEvent.WaitOne(millisecondsTimeout, exitContext)) {
#endif #endif