≈ the.bay.news

Behavior of @ _inheritActorContext in Global vs Instance Actors

Swift Forums
Behavior of @ _inheritActorContext in Global vs Instance Actors
Follow up question after reading through Why is a Task closure defined in an Actor's method nonisolated? - #17 by NotTheNHK Calling foo on the below results in two prints for "MainActor". This makes sense to me -- foo is isolated to the @MainActor by virtue of the enclosing context and the closure passed to Task.init inherits that via @_inheritActorContext. @MainActor final class SomeObject { func foo() { print(#isolation as (any Actor)?) Task { print(#isolatio...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.