Skip to content

Commit

Permalink
Run swift format
Browse files Browse the repository at this point in the history
  • Loading branch information
grdsdev committed Oct 6, 2023
1 parent 20feaf7 commit 8b7348b
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions Tests/PostgRESTTests/BuildURLRequestTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,35 +115,35 @@
}
}

final class LockIsolated<Value>: @unchecked Sendable {
private let lock = NSRecursiveLock()
private var _value: Value
final class LockIsolated<Value>: @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<T>(_ 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<T>(_ 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<R>(work: () throws -> R) rethrows -> R {
lock()
defer { unlock() }
return try work()

extension NSRecursiveLock {
@discardableResult
func sync<R>(work: () throws -> R) rethrows -> R {
lock()
defer { unlock() }
return try work()
}
}
}

#endif

0 comments on commit 8b7348b

Please sign in to comment.