diff options
author | vnugent <public@vaughnnugent.com> | 2024-07-21 20:57:01 -0400 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-07-21 20:57:01 -0400 |
commit | b9b892ab2143b0ab92e4dcf0a8b043c5c6c17271 (patch) | |
tree | 567fd5584568879d191e1e29faaad8f200dcd8a5 /lib/Utils/src/Async | |
parent | 21ffa816f18be4b765ad740ed5d93346ec3b1fda (diff) |
fix spelling Enqueue and deprecate mispelled version
Diffstat (limited to 'lib/Utils/src/Async')
-rw-r--r-- | lib/Utils/src/Async/AsyncQueue.cs | 4 | ||||
-rw-r--r-- | lib/Utils/src/Async/IAsyncQueue.cs | 11 |
2 files changed, 13 insertions, 2 deletions
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<T>(options); /// <inheritdoc/> - public bool TryEnque(T item) => _channel.Writer.TryWrite(item); + public bool TryEnqueue(T item) => _channel.Writer.TryWrite(item); /// <inheritdoc/> /// <exception cref="ObjectDisposedException"></exception> @@ -121,5 +121,7 @@ namespace VNLib.Utils.Async /// <inheritdoc/> /// <exception cref="ObjectDisposedException"></exception> public bool TryPeek([MaybeNullWhen(false)] out T result) => _channel.Reader.TryPeek(out result); + + bool IAsyncQueue<T>.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 /// </summary> /// <param name="item">The item to eqneue</param> /// <returns>True if the queue can accept another item, false otherwise</returns> + bool TryEnqueue(T item); + + /// <summary> + /// Attemts to enqueue an item if the queue has the capacity + /// </summary> + /// <param name="item">The item to eqneue</param> + /// <returns>True if the queue can accept another item, false otherwise</returns> + [Obsolete("Use TryEnqueue instead")] bool TryEnque(T item); /// <summary> |