question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What `AttachExternalCancellation(token)` does?

See original GitHub issue

Every UniTask instance has a method called AttachExternalCancellation which takes a cancellation token.

How this method works and when should we use it?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
neuecccommented, Aug 6, 2022

inside of UniTask.Create is internal task, external cancellation does not stop it as document described.

0reactions
heeencommented, Mar 21, 2023

In the example you have a method (the lambda) that itself is awaiting tasks (delay). then you have the outer method that is creating a task wrapping the lambda.

if you attach an external cancellation, the outer method is allowed to continue and handle the cancelled operation, however the lambda and any tasks awaited on within do not get the cancellationToken and thus cannot be cancelled this way.

@neuecc I am curious if this is a good way to use a UniTaskCancellationSource that is awaited by multiple users which each want to abort waiting on it at different times?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to cancel UniTask.WhenAll()
It has something to do with CancellationTokenSource but I cannot understand how to use it ... AttachExternalCancellation(cancellationToken);.
Read more >
c# - Linking Cancellation Tokens
If the Master Token is cancelled, the Temporary Token must also be cancelled. When the Temporary Token expires it must NOT cancel the...
Read more >
Why cancelling the token freezes the app? : r/Unity3D
The first operation in internet connection checkout, if there's no internet, all operations should be cancelled. But cancelling them freezes the ...
Read more >
CancellationTokenSource.CreateLinkedTokenSource ...
Creates a CancellationTokenSource that will be in the canceled state when any of the source tokens in the specified array are in the...
Read more >
DCL.GifDecoderProcessor - Coverage Report
// the processing of gifs whether im close or looking at them like GLFTs. 45, 80, await UniTask.WaitUntil(() => isRunning == false, cancellationToken:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found