fix(MachPort): silence concurrency check for mach_task_self_ - #379
Draft
aryansk wants to merge 1 commit into
Draft
fix(MachPort): silence concurrency check for mach_task_self_#379aryansk wants to merge 1 commit into
aryansk wants to merge 1 commit into
Conversation
Darwin.Mach's mach_task_self_ is a shared global; Swift 6.3 reports it as not concurrency-safe when imported. Use a preconcurrency import so the existing call sites remain valid without per-call-site suppression. Fixes apple#373
Contributor
|
The concurrency annotations for |
Author
|
Thanks for the clarification. I checked the issue and the current change. Since the annotations come from the macOS 15.4 SDK, the preconcurrency import would suppress them for modern SDKs too. I do not see a portable SDK-version conditional at this import site, so I am leaving the code unchanged rather than broadening suppression. If Swift System has a supported wrapper or conditional pattern for this SDK boundary, I can apply that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Import Darwin.Mach with
@preconcurrencysomach_task_self_(a shared global from Mach) does not trigger Swift 6.3's concurrency check:The existing call sites (
mach_port_guard,mach_port_destruct, etc.) keep their current form; the import attribute suppresses the diagnostic for this known thread-safe global without per-call-site workarounds.Issue
Fixes #373 — 1.8.0
mach_task_self_concurrency error on macos-14 GHA with Swift 6.3.Validation
git diff --checkpasses