test: close diagnostic dispatch gate before signaling

This commit is contained in:
2026-07-11 14:02:18 +09:00
parent bb4a3ec3e0
commit 673d40b09f

View File

@@ -400,13 +400,16 @@ public sealed class PgmConnectDiagnosticTests
public bool TryPreventKtapConnect()
{
PreventionAttempted.Set();
var previous = Interlocked.CompareExchange(ref _dispatchGate, 2, 0);
if (previous == 1 && LastKtapConnectState == PlayoutKtapConnectState.NotAttempted)
{
LastKtapConnectState = PlayoutKtapConnectState.Attempted;
}
// Publish the test synchronization point only after the dispatch gate
// is closed. Signalling first lets the blocked safety probe resume and
// race KTAP dispatch before this prevention attempt has taken effect.
PreventionAttempted.Set();
return previous == 0;
}