mirror of https://github.com/ogoun/Zero.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
384 B
17 lines
384 B
using System.Threading.Tasks;
|
|
|
|
namespace ZeroLevel.Services.Async.Internal
|
|
{
|
|
internal static class CanceledValueTask<T>
|
|
{
|
|
public static readonly ValueTask<T> Value = CreateCanceledTask();
|
|
|
|
private static ValueTask<T> CreateCanceledTask()
|
|
{
|
|
TaskCompletionSource<T> tcs = new TaskCompletionSource<T>();
|
|
tcs.SetCanceled();
|
|
return new ValueTask<T>(tcs.Task);
|
|
}
|
|
}
|
|
}
|