Skip to content

Conversation

@hborla
Copy link
Member

@hborla hborla commented Feb 10, 2024

If a closure is not Sendable, its isolation differs from its enclosing context, and both contexts are actor isolated, treat the closure as if it may execute concurrently. Otherwise, the closure may capture non-Sendable state from the outer context and stash it into isolated state on a different actor, allowing for concurrent access later on.

See https://forums.swift.org/t/should-global-actor-isolated-functions-be-implicitly-sendable/60553/9 for more details.

non-Sendable values that may be isolated to a different actor.
@hborla hborla force-pushed the isolated-closure-capture branch from 7834ec9 to b88e74b Compare February 10, 2024 05:58
@hborla hborla requested a review from ktoso as a code owner February 10, 2024 05:58
@hborla
Copy link
Member Author

hborla commented Feb 10, 2024

@swift-ci please smoke test

@hborla hborla merged commit 5b0d9c4 into swiftlang:main Feb 10, 2024
@hborla hborla deleted the isolated-closure-capture branch February 10, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant