[Accepted] SE-0512: Document that Mutex.withLockIfAvailable(_:) cannot spuriously fail

Hello, Swift community.

The review of SE-0512: Document that Mutex.withLockIfAvailable(_:) cannot spuriously fail ran from February 17th through March 2nd, 2026.

There was a spirited technical discussion in the review about the general advisability of a weak tryLock operation on mutex types, but nobody defended the idea of actually giving this operation weak failure semantics. One contributor made an excellent post citing the C and C++ committees' rationale for their decision. However, since that rationale was centered on relaxing a certain formal property (to avoid an unwanted memory fence), and this relaxation can be achieved in other ways, it is not an argument against documenting strong failure semantics. The LSG agrees with this consensus in the community, and SE-0512 has therefore been accepted.

I'd like thank you everyone who participated in the review for a largely enjoyable and constructive conversation.

John McCall
Review Manager

11 Likes