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:
Kamron Batman 2021-07-11 22:42:06 -07:00 • committed by GitHub
parent b99d520019
commit fb915992dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
138 changed files with 468 additions and 802 deletions

View file

@ -101,7 +101,6 @@ namespace Server.Items
m_Callback = callback;
m_From = from;
m_Hue = hue;
Priority = TimerPriority.TwoFiftyMS;
}
protected override void OnTick()

View file

@ -103,7 +103,6 @@ namespace Server.Items
m_Callback = callback;
m_From = from;
m_Hue = hue;
Priority = TimerPriority.TwoFiftyMS;
}
protected override void OnTick()

View file

@ -142,7 +142,6 @@ namespace Server.Items
public InternalTimer(PickpocketDip dip) : base(TimeSpan.FromSeconds(3.0))
{
m_Dip = dip;
Priority = TimerPriority.FiftyMS;
}
protected override void OnTick()

View file

@ -111,7 +111,6 @@ namespace Server.Items
m_Callback = callback;
m_From = from;
m_Hue = hue;
Priority = TimerPriority.TwoFiftyMS;
}
protected override void OnTick()

View file

@ -103,7 +103,6 @@ namespace Server.Items
m_Callback = callback;
m_From = from;
m_Hue = hue;
Priority = TimerPriority.TwoFiftyMS;
}
protected override void OnTick()

View file

@ -144,7 +144,6 @@ namespace Server.Items
public InternalTimer(TrainingDummy dummy) : base(TimeSpan.FromSeconds(0.25), TimeSpan.FromSeconds(2.75))
{
m_Dummy = dummy;
Priority = TimerPriority.FiftyMS;
}
protected override void OnTick()

View file

@ -201,7 +201,6 @@ namespace Server.Items
public InternalTimer(DeathRobe c, TimeSpan delay) : base(delay)
{
m_Robe = c;
Priority = TimerPriority.FiveSeconds;
}
protected override void OnTick()

View file

@ -563,7 +563,6 @@ namespace Server.Items
public InternalTimer(BaseDoor door) : base(TimeSpan.FromSeconds(20.0), TimeSpan.FromSeconds(10.0))
{
Priority = TimerPriority.OneSecond;
m_Door = door;
}

View file

@ -203,7 +203,6 @@ namespace Server.Items
)
{
m_Chest = chest;
Priority = TimerPriority.OneMinute;
}
protected override void OnTick()

View file

@ -369,7 +369,6 @@ namespace Server.Items
public FurnitureTimer(Container c, Mobile m) : base(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5))
{
Priority = TimerPriority.TwoFiftyMS;
m_Container = c;
m_Mobile = m;

View file

@ -588,7 +588,6 @@ namespace Server.Items
public DeleteTimer(Item item, DateTime time) : base(time - Core.Now)
{
m_Item = item;
Priority = TimerPriority.OneMinute;
}
protected override void OnTick()

View file

@ -355,8 +355,6 @@ namespace Server.Items
public OfferExpireTimer(VendorRentalContract contract) : base(TimeSpan.FromSeconds(30.0))
{
m_Contract = contract;
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()

View file

@ -1186,8 +1186,6 @@ namespace Server.Items
: base(TimeSpan.FromSeconds(5.0), TimeSpan.FromSeconds(5.0))
{
m_Drunk = drunk;
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()

View file

@ -220,7 +220,6 @@ namespace Server.Items
public InternalTimer(BaseLight light, TimeSpan delay) : base(delay)
{
m_Light = light;
Priority = TimerPriority.FiveSeconds;
}
protected override void OnTick()

View file

@ -791,8 +791,6 @@ namespace Server.Items
m_NextSpellTime = from.NextSpellTime;
m_NextActionTime = from.NextActionTime;
m_LastMoveTime = from.LastMoveTime;
Priority = TimerPriority.TenMS;
}
private void Terminate()
@ -932,8 +930,6 @@ namespace Server.Items
{
m_From = from;
m_SoundID = soundID;
Priority = TimerPriority.TenMS;
}
protected override void OnTick()

View file

@ -42,7 +42,6 @@ namespace Server.Items
public InternalTimer(Item blood) : base(TimeSpan.FromSeconds(5.0))
{
Priority = TimerPriority.OneSecond;
m_Blood = blood;
}

View file

@ -1226,7 +1226,6 @@ namespace Server.Items
public InternalTimer(Corpse c, TimeSpan delay) : base(delay)
{
m_Corpse = c;
Priority = TimerPriority.FiveSeconds;
}
protected override void OnTick()

View file

@ -100,7 +100,6 @@ namespace Server.Items
public InternalTimer(DecayedCorpse c, TimeSpan delay) : base(delay)
{
m_Corpse = c;
Priority = TimerPriority.FiveSeconds;
}
protected override void OnTick()

View file

@ -78,7 +78,6 @@ namespace Server.Items
public FreeTimer(EffectItem item, TimeSpan delay) : base(delay)
{
m_Item = item;
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()

View file

@ -79,7 +79,6 @@ namespace Server.Items
public InternalTimer(Item item) : base(TimeSpan.FromSeconds(30.0))
{
m_Item = item;
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()

View file

@ -550,8 +550,6 @@ namespace Server.Items
m_Panel = panel;
m_To = to;
m_Step = 0;
Priority = TimerPriority.TwoFiftyMS;
}
protected override void OnTick()

View file

@ -148,7 +148,6 @@ namespace Server.Items
public EmptyTimer(TrashBarrel barrel) : base(TimeSpan.FromMinutes(3.0))
{
m_Barrel = barrel;
Priority = TimerPriority.FiveSeconds;
}
protected override void OnTick()

View file

@ -83,7 +83,6 @@ namespace Server.Items
public SpawnTimer(Item item) : base(TimeSpan.FromSeconds(Utility.RandomMinMax(5, 10)))
{
Priority = TimerPriority.FiftyMS;
m_Item = item;
}

View file

@ -281,8 +281,6 @@ namespace Server.Items
{
m_Item = item;
m_End = end;
Priority = TimerPriority.FiftyMS;
}
protected override void OnTick()

View file

@ -566,7 +566,6 @@ namespace Server.Items
public InternalTimer(BandageContext context, TimeSpan delay) : base(delay)
{
m_Context = context;
Priority = TimerPriority.FiftyMS;
}
protected override void OnTick()

View file

@ -609,7 +609,6 @@ namespace Server.Items
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(6.0))
{
m_From = from;
Priority = TimerPriority.TwoFiftyMS;
}
protected override void OnTick()

View file

@ -337,7 +337,6 @@ namespace Server.Items
public InternalTimer(Mobile m, TimeSpan delay) : base(delay)
{
m_Player = m;
Priority = TimerPriority.OneMinute;
}
protected override void OnTick()

View file

@ -100,7 +100,6 @@ namespace Server.Items
m_From = from;
m_Item = item;
m_Lockpick = lockpick;
Priority = TimerPriority.TwoFiftyMS;
}
protected void BrokeLockPickTest()

View file

@ -145,8 +145,6 @@ namespace Server.Items
)
{
m_Component = c;
Priority = TimerPriority.OneMinute;
}
protected override void OnTick()

View file

@ -145,8 +145,6 @@ namespace Server.Items
public SpawnTimer(RoseOfTrinsic rose, TimeSpan delay) : base(delay)
{
m_Rose = rose;
Priority = TimerPriority.OneMinute;
}
protected override void OnTick()

View file

@ -67,7 +67,6 @@ namespace Server.Items
: base(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(30))
{
Eater = eater;
Priority = TimerPriority.FiveSeconds;
Start();
}

View file

@ -115,7 +115,6 @@ namespace Server.Items
{
m_From = from;
m_Mobile = m;
Priority = TimerPriority.TwoFiftyMS;
}
protected override void OnTick()

View file

@ -80,7 +80,6 @@ namespace Server.Items
{
m_Bonus = bonus;
m_Mobile = m;
Priority = TimerPriority.TwoFiftyMS;
}
protected override void OnTick()

View file

@ -60,7 +60,6 @@ namespace Server.Items
{
m_Owner = owner;
BonusSwingSpeed = bonusSwingSpeed;
Priority = TimerPriority.FiftyMS;
}
public int BonusSwingSpeed { get; }

View file

@ -65,7 +65,6 @@ namespace Server.Items
{
m_Defender = defender;
SwingSpeedReduction = swingSpeedReduction;
Priority = TimerPriority.FiftyMS;
}
public int SwingSpeedReduction { get; }

View file

@ -110,8 +110,6 @@ namespace Server.Items
m_DamageRemaining = totalDamage;
DamagePerTick = (double)totalDamage / 12 + 0.01;
Priority = TimerPriority.TwentyFiveMS;
}
protected override void OnTick()

View file

@ -65,7 +65,6 @@ namespace Server.Items
{
m_Defender = defender;
m_DamageRemaining = totalDamage;
Priority = TimerPriority.TwentyFiveMS;
DamagePerTick = (double)totalDamage / 12 + .01;
}

View file

@ -446,8 +446,6 @@ namespace Server.Items
public WeaponAbilityTimer(Mobile from) : base(TimeSpan.FromSeconds(3.0))
{
m_Mobile = from;
Priority = TimerPriority.TwentyFiveMS;
}
protected override void OnTick()

View file

@ -294,8 +294,6 @@ namespace Server.Items
{
m_Mobile = m;
Priority = TimerPriority.TwoFiftyMS;
m_Mobile.BeginAction<Fists>();
}

View file

@ -62,7 +62,6 @@ namespace Server.Items
public AttackTimer(Mobile player) : base(AttackEffectDuration)
{
m_Player = player;
Priority = TimerPriority.TwoFiftyMS;
}
protected override void OnTick()
@ -78,7 +77,6 @@ namespace Server.Items
public DefenseTimer(Mobile player) : base(DefenseEffectDuration)
{
m_Player = player;
Priority = TimerPriority.TwoFiftyMS;
}
protected override void OnTick()