Preprocessor directive for .NET 4.0: Framework_4_0. (Removed the 3.5 directive as it wasn't a new framework runtime anyways)

Implemented working Parallel Save strategy based on the TPL: DynamicSaveStrategy.
This commit is contained in:
asayre 2010-12-18 11:00:57 +00:00
parent 5ff9459102
commit 0caf1846d5
5 changed files with 464 additions and 28 deletions

View file

@ -19,33 +19,39 @@
***************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Threading;
using System.Diagnostics;
using Server;
using Server.Guilds;
namespace Server {
public abstract class SaveStrategy {
public static SaveStrategy Acquire() {
if ( Core.MultiProcessor ) {
namespace Server
{
public abstract class SaveStrategy
{
public static SaveStrategy Acquire()
{
if (Core.MultiProcessor)
{
int processorCount = Core.ProcessorCount;
if ( processorCount > 16 ) {
return new ParallelSaveStrategy( processorCount );
} else {
if (processorCount > 16)
{
#if Framework_4_0
return new DynamicSaveStrategy();
#else
return new ParallelSaveStrategy(processorCount);
#endif
}
else
{
return new DualSaveStrategy();
}
} else {
}
else
{
return new StandardSaveStrategy();
}
}
public abstract string Name { get; }
public abstract void Save( SaveMetrics metrics );
public abstract void Save(SaveMetrics metrics);
public abstract void ProcessDecay();
}