fix: Fixed a bug where SafeTimer.Trigger would call the callback twice on NetStandard

This commit is contained in:
Chris Cameron
2021-04-12 15:13:38 -04:00
parent f807db480e
commit 25d799fe7d
2 changed files with 5 additions and 4 deletions

View File

@@ -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();
} }

View File

@@ -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
} }