mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 03:57:32 +00:00
fix: Fixed a bug where SafeTimer.Trigger would call the callback twice on NetStandard
This commit is contained in:
parent
f807db480e
commit
25d799fe7d
2 changed files with 5 additions and 4 deletions
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue