cancellationtoken register

CancellationToken.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 More
cancellationtoken

CancellationTokenSource 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