Conversation
Replace the os_unfair_lock ManagedBuffer with a Mutex held in a final class box, so the wrapper keeps its reference semantics and copyable holders while carrying no platform-specific locking code; it was the only platform-specific code in Sources. Mutex needs macOS 15 / iOS 18 / tvOS 18 / watchOS 11 / visionOS 2, so the manifest moves to that floor (tools 5.9 for the visionOS entry; the language mode is unchanged). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T8cahEd4GfsHQ89sNrmP4p
This was referenced Oct 3, 2026
lhoward
marked this pull request as ready for review
October 3, 2026 22:35
Contributor
|
Closing as superseded by merged PR #74: #74. Current The additional explicit visionOS 2 platform declaration in this PR was not included in #74; that can be considered separately as a visionOS support follow-up. |
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.
Description
ManagedCriticalStateis aManagedBufferaround anos_unfair_lock, which makesSources/Supporting/ManagedCriticalState.swiftthe only platform-specific code inSources/. This replaces it with aSynchronization.Mutexheld in a final-class box, so the wrapper keeps the reference semantics and copyability that the iterators and state machines rely on, and the API (withCriticalRegion,apply(criticalState:),criticalState) is unchanged. The file goes from 45 to 34 lines and the package then builds on Linux as well.The cost is the deployment target:
Mutexneeds macOS 15 / iOS 18 / tvOS 18 / watchOS 11 / visionOS 2, soPackage.swiftmoves to that floor (tools 5.9 only for the visionOS entry; the language mode is unchanged). If you would rather keep the current floor, a#if canImport(Darwin)-gated variant that leaves theos_unfair_lockpath byte-for-byte and usesMutexonly elsewhere is available instead.Tests
Linux, Swift 6.4, x86_64, with the two test-only fixes from the companion PR applied (an unused
import Combineand a sync test that returns before its task; without them the test target does not compile here), three consecutive runs:Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01T8cahEd4GfsHQ89sNrmP4p