Files
ScadaBridge/src/ZB.MOM.WW.ScadaBridge.CentralUI/Services/PollGate.cs
T
Joseph Doherty 5a878b78d4 docs(xml): fill missing XML doc comments + strip task-tracking refs across src (fixdocs)
Add missing <summary>/<param>/<returns>/<typeparam> tags and switch
interface implementations to <inheritdoc/> across 106 files; strip
project bookkeeping identifiers (Task NN, #05-TNN, PLAN-04, StoreAndForward-0NN)
from shipped code comments while preserving the descriptive rationale.
Comment-only: zero code-logic lines changed; solution builds 0/0.

Claude-Session: https://claude.ai/code/session_01MtdgwpEeCUn6cUA5f1LMPj
2026-07-10 08:23:56 -04:00

18 lines
898 B
C#

namespace ZB.MOM.WW.ScadaBridge.CentralUI.Services;
/// <summary>Reentrancy guard for poll timers: a fixed-period Timer whose refresh outlives
/// the period stacks overlapping fan-outs against an already-degraded site (arch-review S3).
/// Callers TryEnter at tick start and skip the tick when the previous refresh is in flight.</summary>
public sealed class PollGate
{
private int _inFlight;
/// <summary>Attempts to enter the gate for a new poll tick.</summary>
/// <returns><see langword="true"/> if no refresh is currently in flight and the caller
/// may proceed; <see langword="false"/> if a previous refresh is still running.</returns>
public bool TryEnter() => Interlocked.CompareExchange(ref _inFlight, 1, 0) == 0;
/// <summary>Releases the gate after a poll tick's refresh has completed.</summary>
public void Exit() => Volatile.Write(ref _inFlight, 0);
}