Skip to content

Take the lock outside the async request, and clear three warnings - #14

Merged
eftpmc merged 1 commit into
mainfrom
swift6-warnings
Sep 24, 2026
Merged

eftpmc merged 1 commit into
mainfrom
swift6-warnings

Conversation

@eftpmc

@eftpmc eftpmc commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

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 goes through a small synchronous accessor that cannot suspend while holding it.

Also in here: restate @unchecked Sendable on EngineNotSetUpException, drop the unused playback binding in tick, and make Vorbis's callbacks a let — it is passed by value and never mutated.

Verification

  • swift test: 399 tests, 0 failures.
  • Built the yuzic app (Debug, iOS 26.5 simulator) with yuzic-engine pinned to this branch: BUILD SUCCEEDED, and the iOS build now reports 0 warnings from node_modules/yuzic-engine, against 4 distinct ones before (the two NSLock ones, the Sendable restatement, the unused binding, and the Vorbis var).

🤖 Generated with Claude Code

https://claude.ai/code/session_014rZdS3TtRMCxvz2j1KhyAg

`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
@eftpmc
eftpmc merged commit 381272b into main Sep 24, 2026
4 checks passed
@eftpmc
eftpmc deleted the swift6-warnings branch September 28, 2026 21:38
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