Obsolesce WaitOneAsync

TaskCompletionSource is recommended for execution suspension while waiting for an asynchronous operation to complete
This commit is contained in:
Oliver Booth 2022-04-25 22:21:08 +01:00
parent 2ead3cbb8a
commit e058ab75bc
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
1 changed files with 8 additions and 2 deletions

View File

@ -1,7 +1,7 @@
namespace X10D;
namespace X10D.Threading;
/// <summary>
/// Extension methods for <see cref="WaitHandle" />.
/// Threading-related extension methods for <see cref="WaitHandle" />.
/// </summary>
public static class WaitHandleExtensions
{
@ -13,6 +13,12 @@ public static class WaitHandleExtensions
/// <see langword="true" /> if the current instance receives a signal. If the current instance is never signaled,
/// <see cref="WaitOneAsync" /> never returns.
/// </returns>
/// <remarks>
/// It is heavily recommended that the use of this method is minimal, or non-existent. For suspension of execution when
/// performing an asynchronous operation, use <see cref="TaskCompletionSource" /> or
/// <see cref="TaskCompletionSource{TResult}" />.
/// </remarks>
[Obsolete("Consider using a TaskCompletionSource instead.")]
public static Task<bool> WaitOneAsync(this WaitHandle handle)
{
if (handle is null)