Change to TrySet method

This commit is contained in:
TORISOUP 2018-05-21 22:44:42 +09:00
parent 6a459e3735
commit 288c440ce6

View File

@ -193,7 +193,7 @@ namespace UniTask
public static Task<T> ToTask<T>(this Schedulable<T> schedulable, IScheduler scheduler)
{
var tcs = new TaskCompletionSource<T>();
schedulable.Subscribe(scheduler, r => tcs.SetResult(r), ex => tcs.SetException(ex));
schedulable.Subscribe(scheduler, r => tcs.TrySetResult(r), ex => tcs.TrySetException(ex));
return tcs.Task;
}
#endif