Who Owns a Cancellation? Four UniTask Experiments on Token Lifetime, Timeouts, Dispose and Background Threads
Who Owns a Cancellation? Four UniTask Experiments on Token Lifetime, Timeouts, Dispose and Background Threads Introduction Every cancellation bug I ran into came down to one question: who owns this piece of work, and does its token live exactly as long as that owner? My notes said things like “use linked tokens”, “short-lived vs long-lived […]
Read MoreSwallowing vs. Re-throwing OperationCanceledException in UniTask
The question If you catch OperationCanceledException in a UniTask step and don’t re-throw it, the rest of the chain keeps running and the whole sequence reports success. I’d read that rule many times, but I wanted to see it happen in my own console, with timestamps and frame numbers as evidence. This post is the record of […]
Read MoreCancellationToken.Register(): The Observer Pattern You Already Know
Checking IsCancellationRequested works, but it only works if something is actively looking. A loop mid-await will notice eventually. But what about code that isn’t looping at all — a resource that just needs to clean itself up the moment cancellation happens, with nobody polling it? That’s what Register() is for. Instead of asking “has this […]
Read MoreCancellationTokenSource in Unity: Why “Stop” Doesn’t Always Stop
Have you ever clicked Stop and watched your code keep running anyway? That’s not a bug. It’s a loop that was never given a way to check. It doesn’t ignore you on purpose — it simply never asked, so it never looks. Fixing this doesn’t require a redesign. It takes one object, threaded through the […]
Read More