+ Don't allow processing of the Timer changed queue while the world is loading or saving.

* Removes the risk of inconsistency [warnings] generated by timers that tick with handlers that modify World.Items and World.Mobiles during I/O.

+ Update description of Core.TickCount.
This commit is contained in:
Vorspire 2015-08-23 01:40:09 +01:00
parent 5d50a5a37c
commit 887ca5d341
3 changed files with 22 additions and 20 deletions

View file

@ -1,10 +1,12 @@
<?xml version="1.0"?>
<configuration>
<runtime>
<gcServer enabled="true" />
</runtime>
<!--
MONO/Linux users will need to uncomment and modify the following line:
-->
<!--<dllmap dll="libz" target="/lib/x86_64-linux-gnu/libz.so.1" />-->
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<runtime>
<gcServer enabled="true" />
</runtime>
<!--MONO/Linux users will need to uncomment and modify the following line:-->
<!--<dllmap dll="libz" target="/lib/x86_64-linux-gnu/libz.so.1" />-->
</configuration>

View file

@ -107,23 +107,17 @@ namespace Server
public static Thread Thread { get { return m_Thread; } }
public static MultiTextWriter MultiConsoleOut { get { return m_MultiConOut; } }
/* DateTime.Now and DateTime.UtcNow are based on actual system clock time.
/*
* DateTime.Now and DateTime.UtcNow are based on actual system clock time.
* The resolution is acceptable but large clock jumps are possible and cause issues.
* GetTickCount and GetTickCount64 have poor resolution.
* GetTickCount64 is unavailable on Windows XP and Windows Server 2003.
* Stopwatch.GetTimestamp() (QueryPerformanceCounter) is high resolution, but
* somewhat expensive to call and unreliable with certain system configurations.
* somewhat expensive to call because of its defference to DateTime.Now,
* which is why Stopwatch has been used to verify HRT before calling GetTimestamp(),
* enabling the usage of DateTime.UtcNow instead.
*/
/* The following implementation contains an effective substitute for GetTickCount64 that
* is reliable as long as it is retrieved once every 2^32 ms (~49 days).
*/
/* We don't really need this, but it may be useful in the future.
private static ThreadLocal<long> _HighOrder = new ThreadLocal<long>();
private static ThreadLocal<uint> _LastTickCount = new ThreadLocal<uint>();
*/
private static readonly bool _HighRes = Stopwatch.IsHighResolution;
private static readonly double _HighFrequency = 1000.0 / Stopwatch.Frequency;

View file

@ -313,6 +313,12 @@ namespace Server
while ( !Core.Closing )
{
if (World.Loading || World.Saving)
{
m_Signal.WaitOne(1, false);
continue;
}
ProcessChanged();
loaded = false;