diff options
author | vnugent <public@vaughnnugent.com> | 2023-12-20 18:33:32 -0500 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2023-12-20 18:33:32 -0500 |
commit | 43542a261ec0789c7e48551ea5f9eaefa8c4b772 (patch) | |
tree | 35d136732bf2a44780a156da6f9963d1ebb2201d /lib/Utils/src/Async | |
parent | 546abea662263ef112c571c29706c47e875e09c4 (diff) |
monocypher vendor and wrapper started, and partial public api updates
Diffstat (limited to 'lib/Utils/src/Async')
-rw-r--r-- | lib/Utils/src/Async/AsyncAccessSerializer.cs | 20 |
1 files changed, 9 insertions, 11 deletions
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 /// <param name="entry">The entry to return to the pool</param> 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 /// <summary> /// Prepres a new <see cref="WaitEntry"/> for - /// its new session. + /// its new moniker object. /// </summary> /// <param name="moniker">The referrence to the moniker to hold</param> 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}"); |