We have developed some patterns to limit the "just sprinkle @unchecked Sendable on it" on codebases.
We should showcase some of our recent locks:
Maybe we should take the chance to show good lock patterns here.
Like for example https://github.com/apple/swift-nio/blob/main/Sources/NIOConcurrencyHelpers/NIOLockedValueBox.swift
which is just:
public struct NIOLockedValueBox<Value> {
public init(_ value: Value)
public func withLockedValue<T>(_ mutate: (inout Value) throws -> T) rethrows -> T
}
extension NIOLockedValueBox: Sendable where Value: Sendable {}
Or also the new Mutex
type -- we can ask https://github.com/swiftlang/swift-evolution/blob/main/proposals/0433-mutex.md @Azoy to provide a small snippet