mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-01-11 19:44:55 +00:00
fix: Fixed a bug where SafeTimer.Trigger would call the callback twice on NetStandard
This commit is contained in:
@@ -49,12 +49,14 @@ namespace ICD.Common.Utils.Tests.Timers
|
|||||||
[Test]
|
[Test]
|
||||||
public void TriggerTest()
|
public void TriggerTest()
|
||||||
{
|
{
|
||||||
bool called = false;
|
int called = 0;
|
||||||
SafeTimer timer = SafeTimer.Stopped(() => called = true);
|
SafeTimer timer = SafeTimer.Stopped(() => called++);
|
||||||
|
|
||||||
timer.Trigger();
|
timer.Trigger();
|
||||||
|
|
||||||
Assert.IsTrue(called);
|
ThreadingUtils.Sleep(50);
|
||||||
|
|
||||||
|
Assert.AreEqual(1, called);
|
||||||
|
|
||||||
timer.Dispose();
|
timer.Dispose();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ namespace ICD.Common.Utils.Timers
|
|||||||
m_Timer.Reset();
|
m_Timer.Reset();
|
||||||
#else
|
#else
|
||||||
m_Timer.Change(0, m_RepeatPeriod);
|
m_Timer.Change(0, m_RepeatPeriod);
|
||||||
m_Callback();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user