Skip to content

[Concurrency][SE-0471] Change isIsolatingCurrent... to return Bool? #81134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented Apr 28, 2025

This changes the isIsolatingCurrentContext function to return Bool? and removes all the witness table trickery we did previously to detect if it was implemented or not. This comes at a cost of trying to invoke it always, before checkIsolated, but it makes for an simpler implementation and more checkable even by third party Swift code which may want to ask this question.

Along with the withSerialExecutor function, this now enables us to check the isolation at runtime when we have an any Actor e.g. from #isolation.

Updates SE-0471 according to
https://forums.swift.org/t/se-0471-improved-custom-serialexecutor-isolation-checking-for-concurrency-runtime/78834/ review discussions

@ktoso ktoso requested review from rjmccall and compnerd as code owners April 28, 2025 08:57
@ktoso ktoso requested review from DougGregor and removed request for compnerd and rjmccall April 28, 2025 08:57
This changes the isIsolatingCurrentContext function to return `Bool?`
and removes all the witness table trickery we did previously to detect
if it was implemented or not. This comes at a cost of trying to invoke
it always, before `checkIsolated`, but it makes for an simpler
implementation and more checkable even by third party Swift code which
may want to ask this question.

Along with the `withSerialExecutor` function, this now enables us to
check the isolation at runtime when we have an `any Actor` e.g. from
`#isolation`.

Updates SE-0471 according to
https://forums.swift.org/t/se-0471-improved-custom-serialexecutor-isolation-checking-for-concurrency-runtime/78834/
review discussions
@ktoso ktoso force-pushed the wip-adjust-isIsolatingCurrentContext-impl branch from 42a6b9a to 22b20e7 Compare April 28, 2025 09:58
@ktoso ktoso requested a review from a team as a code owner April 28, 2025 09:58
@ktoso
Copy link
Contributor Author

ktoso commented Apr 28, 2025

@swift-ci please smoke test

@ktoso ktoso changed the title [Concurrency] Change isIsolatingCurrent... to return Bool? [Concurrency][SE-0471] Change isIsolatingCurrent... to return Bool? Apr 28, 2025
@ktoso
Copy link
Contributor Author

ktoso commented Apr 28, 2025

@swift-ci please smoke test

@ktoso ktoso force-pushed the wip-adjust-isIsolatingCurrentContext-impl branch from 552dcf1 to c779d10 Compare April 28, 2025 11:10
@ktoso
Copy link
Contributor Author

ktoso commented Apr 28, 2025

@swift-ci please smoke test

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