mac/compat: fix building with swift version lower than 5.7
currently we use the withLock function with NSCondition and NSLock,
which are not available on swift versions lower than 5.7. we only added
compatibility fallbacks for NSCondition though. introduced in 1364c80
and #14334.
instead of only adding the fallback to a specific class add it to the
whole protocol all the locking classes use, similar to the actual
implementation.
This commit is contained in:
1 parent
00415f1457
commit
a4d818b4f9
1 file changed
+1
-1
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
#if !swift(>=5.7)
|
||||
extension NSCondition {
|
||||
extension NSLocking {
|
||||
func withLock<R>(_ body: () throws -> R) rethrows -> R {
|
||||
self.lock()
|
||||
defer { self.unlock() }
|
||||
|
||||
Reference in new issue
Block a user