diff --git a/Tests/PostgRESTTests/BuildURLRequestTests.swift b/Tests/PostgRESTTests/BuildURLRequestTests.swift index ad8ed18..3d41666 100644 --- a/Tests/PostgRESTTests/BuildURLRequestTests.swift +++ b/Tests/PostgRESTTests/BuildURLRequestTests.swift @@ -115,35 +115,35 @@ } } -final class LockIsolated: @unchecked Sendable { - private let lock = NSRecursiveLock() - private var _value: Value + final class LockIsolated: @unchecked Sendable { + private let lock = NSRecursiveLock() + private var _value: Value - init(_ value: Value) { - self._value = value - } + init(_ value: Value) { + self._value = value + } - @discardableResult - func withValue(_ block: (inout Value) throws -> T) rethrows -> T { - try lock.sync { - var value = self._value - defer { self._value = value } - return try block(&value) + @discardableResult + func withValue(_ block: (inout Value) throws -> T) rethrows -> T { + try lock.sync { + var value = self._value + defer { self._value = value } + return try block(&value) + } } - } - var value: Value { - lock.sync { self._value } + var value: Value { + lock.sync { self._value } + } } -} - -extension NSRecursiveLock { - @discardableResult - func sync(work: () throws -> R) rethrows -> R { - lock() - defer { unlock() } - return try work() + + extension NSRecursiveLock { + @discardableResult + func sync(work: () throws -> R) rethrows -> R { + lock() + defer { unlock() } + return try work() + } } -} #endif