From b9b892ab2143b0ab92e4dcf0a8b043c5c6c17271 Mon Sep 17 00:00:00 2001 From: vnugent Date: Sun, 21 Jul 2024 20:57:01 -0400 Subject: fix spelling Enqueue and deprecate mispelled version --- lib/Utils/src/Async/AsyncQueue.cs | 4 +++- lib/Utils/src/Async/IAsyncQueue.cs | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'lib/Utils/src') diff --git a/lib/Utils/src/Async/AsyncQueue.cs b/lib/Utils/src/Async/AsyncQueue.cs index ddd2da5..a64733f 100644 --- a/lib/Utils/src/Async/AsyncQueue.cs +++ b/lib/Utils/src/Async/AsyncQueue.cs @@ -104,7 +104,7 @@ namespace VNLib.Utils.Async public AsyncQueue(BoundedChannelOptions options) => _channel = Channel.CreateBounded(options); /// - public bool TryEnque(T item) => _channel.Writer.TryWrite(item); + public bool TryEnqueue(T item) => _channel.Writer.TryWrite(item); /// /// @@ -121,5 +121,7 @@ namespace VNLib.Utils.Async /// /// public bool TryPeek([MaybeNullWhen(false)] out T result) => _channel.Reader.TryPeek(out result); + + bool IAsyncQueue.TryEnque(T item) => TryEnqueue(item); } } diff --git a/lib/Utils/src/Async/IAsyncQueue.cs b/lib/Utils/src/Async/IAsyncQueue.cs index ab786f1..677f34f 100644 --- a/lib/Utils/src/Async/IAsyncQueue.cs +++ b/lib/Utils/src/Async/IAsyncQueue.cs @@ -1,5 +1,5 @@ /* -* Copyright (c) 2023 Vaughn Nugent +* Copyright (c) 2024 Vaughn Nugent * * Library: VNLib * Package: VNLib.Utils @@ -22,6 +22,7 @@ * along with VNLib.Utils. If not, see http://www.gnu.org/licenses/. */ +using System; using System.Threading; using System.Threading.Tasks; using System.Diagnostics.CodeAnalysis; @@ -41,6 +42,14 @@ namespace VNLib.Utils.Async /// /// The item to eqneue /// True if the queue can accept another item, false otherwise + bool TryEnqueue(T item); + + /// + /// Attemts to enqueue an item if the queue has the capacity + /// + /// The item to eqneue + /// True if the queue can accept another item, false otherwise + [Obsolete("Use TryEnqueue instead")] bool TryEnque(T item); /// -- cgit