Skip to content

ref: migrate SentryMutex to Synchronization.Mutex when deployment targets allow #8223

Description

@philprime

Summary

When the SDK's minimum deployment targets are raised to the versions below, replace SentryMutex<T> with Swift's native Synchronization.Mutex:

  • iOS 18.0+
  • iPadOS 18.0+
  • Mac Catalyst 18.0+
  • macOS 15.0+
  • tvOS 18.0+
  • visionOS 2.0+
  • watchOS 11.0+

At that point SentryMutex can become a simple typealias SentryMutex = Mutex, removing the custom os_unfair_lock wrapper entirely.

Context

SentryMutex<T> was introduced in #8214 as a backport of Synchronization.Mutex semantics for current deployment targets. The native Mutex uses the same underlying os_unfair_lock primitive on Apple platforms, so the migration should be straightforward.

Deployment target bumps follow the policy of dropping versions when Xcode stops allowing them (see discussion). For reference, Xcode 27 drops macOS 12 (#8113) and watchOS 7 (#8189).

See also the review discussion about runtime exclusivity checks and alternative storage patterns — once we move to Synchronization.Mutex, those concerns go away since the stdlib implementation handles them.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions