public static (UniTask, CancellationTokenRegistration) ToUniTask(this CancellationToken cts) {
			if (cts.IsCancellationRequested) {
				return (UniTask.FromCanceled(cts), default(CancellationTokenRegistration));
			}

			var promise = new UniTaskCompletionSource<AsyncUnit>();
			return (promise.Task, cts.RegisterWithoutCaptureExecutionContext(cancellationTokenCallback, promise));
		}
Пример #2
0
 public static (UniTask, CancellationTokenRegistration) ToUniTask(this CancellationToken cts)
 {
     if (cts.IsCancellationRequested)
     {
         return(UniTask.FromCanceled(cts), default);