In a class annotated with a global actor, deinit
isn’t isolated to an actor. It can’t be because the last reference to the actor could go out of scope on any thread/task. This is noted in the Global Actors proposal.
It’s possible to use async
/Task.detached
to switch to the main actor, but this is unsafe.