Skip to content

[Concurrency] Make initial executor construction fully thread safe. #81326

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 1 commit into
base: release/6.2
Choose a base branch
from

Conversation

al45tair
Copy link
Contributor

@al45tair al45tair commented May 6, 2025

I had originally thought that we'd get away without this because the executor construction generally happens in the async main function, but of course if a program doesn't already use Swift Concurrency, and someone uses it from a plug-in or library it loads, there's a risk that we might have a race condition.

rdar://150753884

I had originally thought that we'd get away without this because the
executor construction generally happens in the async `main` function,
but of course if a program doesn't already use Swift Concurrency,
and someone uses it from a plug-in or library it loads, there's a
risk that we might have a race condition.

rdar://149346132
@al45tair al45tair added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.2 labels May 6, 2025
@al45tair al45tair requested a review from a team as a code owner May 6, 2025 10:51
@al45tair
Copy link
Contributor Author

al45tair commented May 6, 2025

Explanation: This fixes an issue where if a program that doesn't use Swift Concurrency itself loads a library that does, and that library is multithreaded, we can end up with a race condition trying to initialise the executors.
Risk: Low. Fixes a bug.
Original PR: #80896
Reviewed by: @ktoso
Resolves: rdar://149346132 (rdar://150753884 is for the cherry pick)
Tests: Tested against the program that triggered the problem.

@al45tair
Copy link
Contributor Author

al45tair commented May 6, 2025

@swift-ci Please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants