From 43542a261ec0789c7e48551ea5f9eaefa8c4b772 Mon Sep 17 00:00:00 2001 From: vnugent Date: Wed, 20 Dec 2023 18:33:32 -0500 Subject: monocypher vendor and wrapper started, and partial public api updates --- lib/Utils/src/Async/AsyncAccessSerializer.cs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'lib/Utils/src/Async') diff --git a/lib/Utils/src/Async/AsyncAccessSerializer.cs b/lib/Utils/src/Async/AsyncAccessSerializer.cs index 83cc127..76532bc 100644 --- a/lib/Utils/src/Async/AsyncAccessSerializer.cs +++ b/lib/Utils/src/Async/AsyncAccessSerializer.cs @@ -235,7 +235,7 @@ namespace VNLib.Utils.Async wait = new(); } - //Init wait with session + //Init wait with moniker wait.Prepare(moniker); } @@ -246,7 +246,7 @@ namespace VNLib.Utils.Async /// The entry to return to the pool protected virtual void ReturnEntry(WaitEntry entry) { - //Remove session ref + //Remove ref entry.Prepare(default); if (EntryPool.Count < MaxPoolSize) @@ -391,7 +391,7 @@ namespace VNLib.Utils.Async /// /// Prepres a new for - /// its new session. + /// its new moniker object. /// /// The referrence to the moniker to hold public void Prepare(TMoniker? moniker) @@ -516,15 +516,13 @@ namespace VNLib.Utils.Async * will be thrown if this doesnt work */ - if (_nextWaiter.Status == TaskStatus.Created) + switch (_nextWaiter.Status) { - _nextWaiter.Start(); - return true; - } - - if(_nextWaiter.Status == TaskStatus.Canceled) - { - return false; + case TaskStatus.Canceled: + return false; + case TaskStatus.Created: + _nextWaiter.Start(); + return true; } Debug.Fail($"Next waiting task is in an invalid state: {_nextWaiter.Status}"); -- cgit