actor-isolated な context を引き継ぐ条件がよくわからなくなってきました・・・。 @MainActor
な API で↓を実行したときに、 print("#0", Thread.current, Thread.current == Thread.main) Task { print("#1a", Thread.current, Thread.current == Thread.main) Task { print("#1b", Thread.current, Thread.current == Thread.main) } } task { print("#2a", Thread.current, Thread.current == Thread.main) Task { print("#2b", Thread.current, Thread.current == Thread.main) } } Task.detached { print("#3a", Thread.current, Thread.current == Thread.main) Task { print("#3b", Thread.current, Thread.current == Thread.main) } } taskDetached { print("#4a", Thread.current, Thread.current == Thread.main) Task { print("#4b", Thread.current, Thread.current == Thread.main) } } DispatchQueue.main.async { print("#5a", Thread.current, Thread.current == Thread.main) Task { print("#5b", Thread.current, Thread.current == Thread.main) } } dispatchQueueMainAsync { print("#6a", Thread.current, Thread.current == Thread.main) Task { print("#6b", Thread.current, Thread.current == Thread.main) } } DispatchQueue.global().async { print("#7a", Thread.current, Thread.current == Thread.main) Task { print("#7b", Thread.current, Thread.current == Thread.main) } } dispatchQueueGlobalAsync { print("#8a", Thread.current, Thread.current == Thread.main) Task { print("#8b", Thread.current, Thread.current == Thread.main) } }