mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-07-02 10:38:16 +00:00
Merge pull request #1250 from PepperDash/generic-comm-monitor-issues
This commit is contained in:
commit
d8c7e3cfc7
2 changed files with 15 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>2.0.0-local</Version>
|
<Version>2.4.0-local</Version>
|
||||||
<InformationalVersion>$(Version)</InformationalVersion>
|
<InformationalVersion>$(Version)</InformationalVersion>
|
||||||
<Authors>PepperDash Technology</Authors>
|
<Authors>PepperDash Technology</Authors>
|
||||||
<Company>PepperDash Technology</Company>
|
<Company>PepperDash Technology</Company>
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ namespace PepperDash.Essentials.Core
|
||||||
|
|
||||||
private Timer PollTimer;
|
private Timer PollTimer;
|
||||||
|
|
||||||
|
private SemaphoreSlim semaphore = new SemaphoreSlim(1, 1);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GenericCommunicationMonitor constructor
|
/// GenericCommunicationMonitor constructor
|
||||||
///
|
///
|
||||||
|
|
@ -201,14 +203,21 @@ namespace PepperDash.Essentials.Core
|
||||||
|
|
||||||
private void BeginPolling()
|
private void BeginPolling()
|
||||||
{
|
{
|
||||||
lock (_pollTimerLock)
|
try
|
||||||
{
|
{
|
||||||
if (PollTimer != null)
|
semaphore.Wait();
|
||||||
{
|
{
|
||||||
return;
|
if (PollTimer != null)
|
||||||
}
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PollTimer = new Timer(o => Poll(), null, 0, PollTime);
|
PollTimer = new Timer(o => Poll(), null, 0, PollTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
semaphore.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue