From e29fab19f6c8594b451b720fe7fc6e337bf18db0 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Tue, 18 Aug 2026 07:13:16 -0400 Subject: [PATCH] =?UTF-8?q?test(acl):=20correct=20the=20array-cell=20comme?= =?UTF-8?q?nt=20=E2=80=94=20captured=20locals=20do=20take=20ref=20(re-revi?= =?UTF-8?q?ew=20nit)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SessionAclDecisionCacheTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/SessionAclDecisionCacheTests.cs b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/SessionAclDecisionCacheTests.cs index 2ab67dce..325f181a 100644 --- a/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/SessionAclDecisionCacheTests.cs +++ b/tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests/SessionAclDecisionCacheTests.cs @@ -578,9 +578,9 @@ public sealed class SessionAclDecisionCacheTests(ITestOutputHelper output) const int rounds = 10_000; const int spinsBeforeYield = 4_000; - // Array-as-ref-cell: a one-element array is the cheapest storage a lambda can close over AND that - // Volatile.Read/Write can take a `ref` to — a captured local cannot be passed by ref, and a plain - // field would need the test moved onto the class. + // Array-as-ref-cell: the one cell that is re-seated every round (a fresh cache per round), shared + // by the starter and both racers. A captured local would also take `ref` (gate/finished below do + // exactly that) — the array is a readability choice marking the re-seated slot, not a necessity. var slot = new SessionAclDecisionCache[1]; var gate = 0; // starter's release signal: the round number both racers are cleared to run var finished = 0; // racers' completion count for the current round