File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ public final class LockIsolated<Value>: @unchecked Sendable {
39
39
/// - Parameter operation: An operation to be performed on the the underlying value with a lock.
40
40
/// - Returns: The result of the operation.
41
41
public func withValue< T: Sendable > (
42
- _ operation: ( inout Value ) throws -> T
42
+ _ operation: @ Sendable ( inout Value ) throws -> T
43
43
) rethrows -> T {
44
44
try self . lock. sync {
45
45
var value = self . _value
@@ -93,15 +93,17 @@ extension LockIsolated where Value: Sendable {
93
93
}
94
94
}
95
95
96
+ @available ( * , deprecated, message: " Lock isolated values should not be equatable " )
96
97
extension LockIsolated : Equatable where Value: Equatable {
97
98
public static func == ( lhs: LockIsolated , rhs: LockIsolated ) -> Bool {
98
- lhs. withValue { lhsValue in rhs . withValue { rhsValue in lhsValue == rhsValue } }
99
+ lhs. value == rhs . value
99
100
}
100
101
}
101
102
103
+ @available ( * , deprecated, message: " Lock isolated values should not be hashable " )
102
104
extension LockIsolated : Hashable where Value: Hashable {
103
105
public func hash( into hasher: inout Hasher ) {
104
- self . withValue { hasher. combine ( $0 ) }
106
+ hasher. combine ( self . value )
105
107
}
106
108
}
107
109
You can’t perform that action at this time.
0 commit comments