Various fixes related to DefaultName. Makes the event loop more async.

This commit is contained in:
Kamron Batman 2018-09-03 14:44:48 -07:00
parent 6ef32ce910
commit 4d2965d2de
No known key found for this signature in database
GPG key ID: 9F6247D24FA2AAD4
5 changed files with 29 additions and 28 deletions

View file

@ -519,7 +519,7 @@ namespace Server
try
{
long now, last = TickCount;
long last = TickCount;
const int sampleInterval = 100;
const float ticksPerSecond = 1000.0f * sampleInterval;
@ -530,24 +530,25 @@ namespace Server
{
m_Signal.WaitOne();
Mobile.ProcessDeltaQueue();
Item.ProcessDeltaQueue();
Task.WaitAll(
Task.Run(() => Mobile.ProcessDeltaQueue()),
Task.Run(() => Item.ProcessDeltaQueue()),
Task.Run(() => Timer.Slice()),
Task.Run(() => messagePump.Slice())
);
Timer.Slice();
messagePump.Slice();
NetState.FlushAll();
NetState.ProcessDisposedQueue();
if ( Slice != null )
Slice();
Slice?.Invoke();
if (sample++ % sampleInterval != 0)
{
continue;
}
now = TickCount;
long now = TickCount;
m_CyclesPerSecond[m_CycleIndex++ % m_CyclesPerSecond.Length] = ticksPerSecond / (now - last);
last = now;
}