fix(core): Adds Hashed & Hierarchical Timer Wheel (#655)
- Removes TimerPriority - Removes TimerThread - Adds a [Hashed & Hierarchical Timer Wheel](http://www.cs.columbia.edu/~nahum/w6998/papers/ton97-timing-wheels.pdf)
This commit is contained in:
parent
b99d520019
commit
fb915992dd
138 changed files with 468 additions and 802 deletions
|
|
@ -61,7 +61,6 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
public CannedEvilTimer() : base(TimeSpan.Zero, TimeSpan.FromMinutes(1.0))
|
||||
{
|
||||
Priority = TimerPriority.OneMinute;
|
||||
_sliceTime = Core.Now;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -798,7 +798,6 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_Bomb = bomb;
|
||||
m_Count = 0;
|
||||
Priority = TimerPriority.FiftyMS;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
|
|
|
|||
|
|
@ -211,8 +211,6 @@ namespace Server.Engines.ConPVP
|
|||
m_Hill = hill;
|
||||
Captures = 0;
|
||||
m_Counter = 0;
|
||||
|
||||
Priority = TimerPriority.FiftyMS;
|
||||
}
|
||||
|
||||
public int Captures { get; private set; }
|
||||
|
|
|
|||
|
|
@ -271,7 +271,6 @@ namespace Server.Menus.Questions
|
|||
TimeSpan.FromSeconds(1.0)
|
||||
)
|
||||
{
|
||||
Priority = TimerPriority.TwoFiftyMS;
|
||||
|
||||
m_Mobile = mobile;
|
||||
m_Destination = destination;
|
||||
|
|
|
|||
|
|
@ -123,8 +123,6 @@ namespace Server.Items
|
|||
m_Item = item;
|
||||
m_CloseTime = Core.Now + item.CloseDelay;
|
||||
m_Up = true;
|
||||
|
||||
Priority = TimerPriority.TenMS;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
|
|
@ -154,7 +152,9 @@ namespace Server.Items
|
|||
m_Step = 0;
|
||||
|
||||
var delay = m_CloseTime - Core.Now;
|
||||
DelayCall(delay > TimeSpan.Zero ? delay : TimeSpan.Zero, Start);
|
||||
|
||||
static void start(Timer timer) => timer.Start();
|
||||
DelayCall(delay, start, this);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,8 +131,6 @@ namespace Server.Items
|
|||
public ResetTimer(RaiseSwitch raiseSwitch, TimeSpan delay) : base(delay)
|
||||
{
|
||||
m_RaiseSwitch = raiseSwitch;
|
||||
|
||||
Priority = ComputePriority(delay);
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
|
|
|
|||
|
|
@ -156,7 +156,6 @@ namespace Server.Items
|
|||
public EndActionTimer(Mobile from) : base(TimeSpan.FromMinutes(3.0))
|
||||
{
|
||||
m_From = from;
|
||||
Priority = TimerPriority.FiveSeconds;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
|
|
@ -289,8 +288,6 @@ namespace Server.Items
|
|||
Location = location;
|
||||
Map = map;
|
||||
From = from;
|
||||
|
||||
Priority = TimerPriority.TwoFiftyMS;
|
||||
}
|
||||
|
||||
public Point3D Location { get; }
|
||||
|
|
@ -806,7 +803,6 @@ namespace Server.Items
|
|||
public InternalTimer(GreenThornsSHTeleporter teleporter) : base(TimeSpan.FromMinutes(1.0))
|
||||
{
|
||||
m_Teleporter = teleporter;
|
||||
Priority = TimerPriority.FiveSeconds;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
|
|
|
|||
|
|
@ -111,7 +111,6 @@ namespace Server.Engines.Quests.Necro
|
|||
|
||||
public CallingTimer(PlayerMobile player) : base(TimeSpan.Zero, TimeSpan.FromSeconds(1.0), 6)
|
||||
{
|
||||
Priority = TimerPriority.TwentyFiveMS;
|
||||
|
||||
m_Player = player;
|
||||
m_Step = 0;
|
||||
|
|
|
|||
|
|
@ -172,7 +172,6 @@ namespace Server.Engines.Quests.Necro
|
|||
|
||||
public SummonTimer(PlayerMobile player) : base(TimeSpan.FromSeconds(4.0))
|
||||
{
|
||||
Priority = TimerPriority.FiftyMS;
|
||||
|
||||
m_Player = player;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ namespace Server.Items
|
|||
public ShowStew(AddonComponent ac) : base(TimeSpan.FromSeconds(30))
|
||||
{
|
||||
stew = ac;
|
||||
Priority = TimerPriority.OneSecond;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ namespace Server.Engines.Spawners
|
|||
[CommandProperty(AccessLevel.Developer)]
|
||||
public TimeSpan NextSpawn
|
||||
{
|
||||
get => m_Running && m_Timer?.Running == true ? End - Core.Now : TimeSpan.FromSeconds(0);
|
||||
get => m_Running && m_Timer?.Running == true ? End - Core.Now : TimeSpan.Zero;
|
||||
set
|
||||
{
|
||||
Start();
|
||||
|
|
@ -1003,12 +1003,7 @@ namespace Server.Engines.Spawners
|
|||
m_HomeRange = reader.ReadInt();
|
||||
m_Running = reader.ReadBool();
|
||||
|
||||
var ts = TimeSpan.Zero;
|
||||
|
||||
if (m_Running)
|
||||
{
|
||||
ts = reader.ReadDeltaTime() - Core.Now;
|
||||
}
|
||||
var ts = m_Running ? reader.ReadDeltaTime() - Core.Now : TimeSpan.Zero;
|
||||
|
||||
if (version < 7)
|
||||
{
|
||||
|
|
@ -1083,12 +1078,7 @@ namespace Server.Engines.Spawners
|
|||
{
|
||||
private readonly BaseSpawner m_Spawner;
|
||||
|
||||
public InternalTimer(BaseSpawner spawner, TimeSpan delay) : base(delay)
|
||||
{
|
||||
Priority = spawner.IsFull ? TimerPriority.FiveSeconds : TimerPriority.OneSecond;
|
||||
|
||||
m_Spawner = spawner;
|
||||
}
|
||||
public InternalTimer(BaseSpawner spawner, TimeSpan delay) : base(delay) => m_Spawner = spawner;
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue