Merge pull request #1250 from PepperDash/generic-comm-monitor-issues

This commit is contained in:
Neil Dorin 2025-04-11 12:49:39 -06:00 committed by GitHub
commit d8c7e3cfc7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 6 deletions

View file

@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>2.0.0-local</Version>
<Version>2.4.0-local</Version>
<InformationalVersion>$(Version)</InformationalVersion>
<Authors>PepperDash Technology</Authors>
<Company>PepperDash Technology</Company>

View file

@ -30,6 +30,8 @@ namespace PepperDash.Essentials.Core
private Timer PollTimer;
private SemaphoreSlim semaphore = new SemaphoreSlim(1, 1);
/// <summary>
/// GenericCommunicationMonitor constructor
///
@ -201,7 +203,9 @@ namespace PepperDash.Essentials.Core
private void BeginPolling()
{
lock (_pollTimerLock)
try
{
semaphore.Wait();
{
if (PollTimer != null)
{
@ -211,6 +215,11 @@ namespace PepperDash.Essentials.Core
PollTimer = new Timer(o => Poll(), null, 0, PollTime);
}
}
finally
{
semaphore.Release();
}
}
/// <summary>
/// Stop the poll cycle