Skip to content

Commit

Permalink
autoReleaseWhenCancelled -> autoReleaseWhenCanceled
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Jan 25, 2024
1 parent 08184af commit 5bfccaa
Showing 1 changed file with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public static UniTask.Awaiter GetAwaiter(this AsyncOperationHandle handle)
return ToUniTask(handle).GetAwaiter();
}

public static UniTask WithCancellation(this AsyncOperationHandle handle, CancellationToken cancellationToken, bool cancelImmediately = false, bool autoReleaseWhenCancelled = false)
public static UniTask WithCancellation(this AsyncOperationHandle handle, CancellationToken cancellationToken, bool cancelImmediately = false, bool autoReleaseWhenCanceled = false)
{
return ToUniTask(handle, cancellationToken: cancellationToken, cancelImmediately: cancelImmediately, autoReleaseWhenCancelled: autoReleaseWhenCancelled);
return ToUniTask(handle, cancellationToken: cancellationToken, cancelImmediately: cancelImmediately, autoReleaseWhenCanceled: autoReleaseWhenCanceled);
}

public static UniTask ToUniTask(this AsyncOperationHandle handle, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false, bool autoReleaseWhenCancelled = false)
public static UniTask ToUniTask(this AsyncOperationHandle handle, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false, bool autoReleaseWhenCanceled = false)
{
if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled(cancellationToken);

Expand All @@ -45,7 +45,7 @@ public static UniTask WithCancellation(this AsyncOperationHandle handle, Cancell
return UniTask.CompletedTask;
}

return new UniTask(AsyncOperationHandleConfiguredSource.Create(handle, timing, progress, cancellationToken, cancelImmediately, autoReleaseWhenCancelled, out var token), token);
return new UniTask(AsyncOperationHandleConfiguredSource.Create(handle, timing, progress, cancellationToken, cancelImmediately, autoReleaseWhenCanceled, out var token), token);
}

public struct AsyncOperationHandleAwaiter : ICriticalNotifyCompletion
Expand Down Expand Up @@ -109,7 +109,7 @@ static AsyncOperationHandleConfiguredSource()
CancellationToken cancellationToken;
CancellationTokenRegistration cancellationTokenRegistration;
IProgress<float> progress;
bool autoReleaseWhenCancelled;
bool autoReleaseWhenCanceled;
bool completed;

UniTaskCompletionSourceCore<AsyncUnit> core;
Expand All @@ -119,7 +119,7 @@ static AsyncOperationHandleConfiguredSource()
completedCallback = HandleCompleted;
}

public static IUniTaskSource Create(AsyncOperationHandle handle, PlayerLoopTiming timing, IProgress<float> progress, CancellationToken cancellationToken, bool cancelImmediately, bool autoReleaseWhenCancelled, out short token)
public static IUniTaskSource Create(AsyncOperationHandle handle, PlayerLoopTiming timing, IProgress<float> progress, CancellationToken cancellationToken, bool cancelImmediately, bool autoReleaseWhenCanceled, out short token)
{
if (cancellationToken.IsCancellationRequested)
{
Expand All @@ -135,14 +135,14 @@ public static IUniTaskSource Create(AsyncOperationHandle handle, PlayerLoopTimin
result.progress = progress;
result.cancellationToken = cancellationToken;
result.completed = false;
result.autoReleaseWhenCancelled = autoReleaseWhenCancelled;
result.autoReleaseWhenCanceled = autoReleaseWhenCanceled;

if (cancelImmediately && cancellationToken.CanBeCanceled)
{
result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>
{
var promise = (AsyncOperationHandleConfiguredSource)state;
if (promise.autoReleaseWhenCancelled && promise.handle.IsValid())
if (promise.autoReleaseWhenCanceled && promise.handle.IsValid())
{
Addressables.Release(promise.handle);
}
Expand Down Expand Up @@ -176,7 +176,7 @@ void HandleCompleted(AsyncOperationHandle _)
completed = true;
if (cancellationToken.IsCancellationRequested)
{
if (autoReleaseWhenCancelled && handle.IsValid())
if (autoReleaseWhenCanceled && handle.IsValid())
{
Addressables.Release(handle);
}
Expand Down Expand Up @@ -224,7 +224,7 @@ public bool MoveNext()
if (cancellationToken.IsCancellationRequested)
{
completed = true;
if (autoReleaseWhenCancelled && handle.IsValid())
if (autoReleaseWhenCanceled && handle.IsValid())
{
Addressables.Release(handle);
}
Expand Down Expand Up @@ -261,12 +261,12 @@ public static UniTask<T>.Awaiter GetAwaiter<T>(this AsyncOperationHandle<T> hand
return ToUniTask(handle).GetAwaiter();
}

public static UniTask<T> WithCancellation<T>(this AsyncOperationHandle<T> handle, CancellationToken cancellationToken, bool cancelImmediately = false, bool autoReleaseWhenCancelled = false)
public static UniTask<T> WithCancellation<T>(this AsyncOperationHandle<T> handle, CancellationToken cancellationToken, bool cancelImmediately = false, bool autoReleaseWhenCanceled = false)
{
return ToUniTask(handle, cancellationToken: cancellationToken, cancelImmediately: cancelImmediately, autoReleaseWhenCancelled: autoReleaseWhenCancelled);
return ToUniTask(handle, cancellationToken: cancellationToken, cancelImmediately: cancelImmediately, autoReleaseWhenCanceled: autoReleaseWhenCanceled);
}

public static UniTask<T> ToUniTask<T>(this AsyncOperationHandle<T> handle, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false, bool autoReleaseWhenCancelled = false)
public static UniTask<T> ToUniTask<T>(this AsyncOperationHandle<T> handle, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken), bool cancelImmediately = false, bool autoReleaseWhenCanceled = false)
{
if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<T>(cancellationToken);

Expand All @@ -284,7 +284,7 @@ public static UniTask<T> WithCancellation<T>(this AsyncOperationHandle<T> handle
return UniTask.FromResult(handle.Result);
}

return new UniTask<T>(AsyncOperationHandleConfiguredSource<T>.Create(handle, timing, progress, cancellationToken, cancelImmediately, autoReleaseWhenCancelled, out var token), token);
return new UniTask<T>(AsyncOperationHandleConfiguredSource<T>.Create(handle, timing, progress, cancellationToken, cancelImmediately, autoReleaseWhenCanceled, out var token), token);
}

sealed class AsyncOperationHandleConfiguredSource<T> : IUniTaskSource<T>, IPlayerLoopItem, ITaskPoolNode<AsyncOperationHandleConfiguredSource<T>>
Expand All @@ -303,7 +303,7 @@ static AsyncOperationHandleConfiguredSource()
CancellationToken cancellationToken;
CancellationTokenRegistration cancellationTokenRegistration;
IProgress<float> progress;
bool autoReleaseWhenCancelled;
bool autoReleaseWhenCanceled;
bool completed;

UniTaskCompletionSourceCore<T> core;
Expand All @@ -313,7 +313,7 @@ static AsyncOperationHandleConfiguredSource()
completedCallback = HandleCompleted;
}

public static IUniTaskSource<T> Create(AsyncOperationHandle<T> handle, PlayerLoopTiming timing, IProgress<float> progress, CancellationToken cancellationToken, bool cancelImmediately, bool autoReleaseWhenCancelled, out short token)
public static IUniTaskSource<T> Create(AsyncOperationHandle<T> handle, PlayerLoopTiming timing, IProgress<float> progress, CancellationToken cancellationToken, bool cancelImmediately, bool autoReleaseWhenCanceled, out short token)
{
if (cancellationToken.IsCancellationRequested)
{
Expand All @@ -329,14 +329,14 @@ public static IUniTaskSource<T> Create(AsyncOperationHandle<T> handle, PlayerLoo
result.cancellationToken = cancellationToken;
result.completed = false;
result.progress = progress;
result.autoReleaseWhenCancelled = autoReleaseWhenCancelled;
result.autoReleaseWhenCanceled = autoReleaseWhenCanceled;

if (cancelImmediately && cancellationToken.CanBeCanceled)
{
result.cancellationTokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(state =>
{
var promise = (AsyncOperationHandleConfiguredSource<T>)state;
if (promise.autoReleaseWhenCancelled && promise.handle.IsValid())
if (promise.autoReleaseWhenCanceled && promise.handle.IsValid())
{
Addressables.Release(promise.handle);
}
Expand Down Expand Up @@ -370,7 +370,7 @@ void HandleCompleted(AsyncOperationHandle<T> argHandle)
completed = true;
if (cancellationToken.IsCancellationRequested)
{
if (autoReleaseWhenCancelled && handle.IsValid())
if (autoReleaseWhenCanceled && handle.IsValid())
{
Addressables.Release(handle);
}
Expand Down Expand Up @@ -423,7 +423,7 @@ public bool MoveNext()
if (cancellationToken.IsCancellationRequested)
{
completed = true;
if (autoReleaseWhenCancelled && handle.IsValid())
if (autoReleaseWhenCanceled && handle.IsValid())
{
Addressables.Release(handle);
}
Expand Down

0 comments on commit 5bfccaa

Please sign in to comment.