swiftlang/swift-corelibs-foundation

NSLock does not conform to Sendable on Linux

Closed this issue · 0 comments

As per the documentation NSLock should conform to Sendable. And indeed, when compiling my code with strict concurrency checking on macOS, no warnings are issued.

However, when compiling on Linux, I get the warning:

warning: static property 'lock' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor; this is an error in Swift 6
    static private let lock = NSLock()

From discussion on the Swift forum, I conclude that this is unintended and NSLock on Linux too should conform to Sendable.

Perhaps this can be fixed?