Take the lock outside the async request, and clear three warnings - #14
Merged
Merged
Conversation
`NSLock`'s `lock()` and `unlock()` are unavailable from an asynchronous context — a warning today, an error in the Swift 6 language mode — because holding one across a suspension point blocks a cooperative thread. `request` took the lock inline to read the session; it now calls a small synchronous accessor that cannot suspend while holding it. Also: restate `@unchecked Sendable` on `EngineNotSetUpException`, drop the unused `playback` binding in `tick`, and make Vorbis's `callbacks` a `let` — it is passed by value, never mutated. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014rZdS3TtRMCxvz2j1KhyAg
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.
NSLock'slock()andunlock()are unavailable from an asynchronous context — a warning today, an error in the Swift 6 language mode — because holding one across a suspension point blocks a cooperative thread.requesttook the lock inline to read the session; it now goes through a small synchronous accessor that cannot suspend while holding it.Also in here: restate
@unchecked SendableonEngineNotSetUpException, drop the unusedplaybackbinding intick, and make Vorbis'scallbacksalet— it is passed by value and never mutated.Verification
swift test: 399 tests, 0 failures.yuzic-enginepinned to this branch: BUILD SUCCEEDED, and the iOS build now reports 0 warnings fromnode_modules/yuzic-engine, against 4 distinct ones before (the twoNSLockones, theSendablerestatement, the unused binding, and the Vorbisvar).🤖 Generated with Claude Code
https://claude.ai/code/session_014rZdS3TtRMCxvz2j1KhyAg