[Unwrap] add ConfigureAwait

pull/162/head
hikari 2020-09-09 14:15:03 +09:00 committed by GitHub
parent 87dd5f13fd
commit 65622b01f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 0 deletions

View File

@ -741,22 +741,42 @@ namespace Cysharp.Threading.Tasks
{ {
return await await task; return await await task;
} }
public static async UniTask<T> Unwrap<T>(this Task<UniTask<T>> task, bool continueOnCapturedContext)
{
return await await task.ConfigureAwait(continueOnCapturedContext);
}
public static async UniTask Unwrap(this Task<UniTask> task) public static async UniTask Unwrap(this Task<UniTask> task)
{ {
await await task; await await task;
} }
public static async UniTask Unwrap(this Task<UniTask> task, bool continueOnCapturedContext)
{
await await task.ConfigureAwait(continueOnCapturedContext);
}
public static async UniTask<T> Unwrap<T>(this UniTask<Task<T>> task) public static async UniTask<T> Unwrap<T>(this UniTask<Task<T>> task)
{ {
return await await task; return await await task;
} }
public static async UniTask<T> Unwrap<T>(this UniTask<Task<T>> task, bool continueOnCapturedContext)
{
return await (await task).ConfigureAwait(continueOnCapturedContext);
}
public static async UniTask Unwrap(this UniTask<Task> task) public static async UniTask Unwrap(this UniTask<Task> task)
{ {
await await task; await await task;
} }
public static async UniTask Unwrap(this UniTask<Task> task, bool continueOnCapturedContext)
{
await (await task).ConfigureAwait(continueOnCapturedContext);
}
#if UNITY_2018_3_OR_NEWER #if UNITY_2018_3_OR_NEWER
sealed class ToCoroutineEnumerator : IEnumerator sealed class ToCoroutineEnumerator : IEnumerator