@@ -124,7 +124,8 @@ extension Mutex where State: ~Copyable {
124
124
/// - Warning: Recursive calls to `withLock` within the
125
125
/// closure parameter has behavior that is platform dependent.
126
126
/// Some platforms may choose to panic the process, deadlock,
127
- /// or leave this behavior unspecified.
127
+ /// or leave this behavior unspecified. This will never
128
+ /// reacquire the lock however.
128
129
///
129
130
/// - Parameter body: A closure with a parameter of `State`
130
131
/// that has exclusive access to the value being stored within
@@ -133,9 +134,9 @@ extension Mutex where State: ~Copyable {
133
134
/// acquired the lock.
134
135
///
135
136
/// - Returns: The return value, if any, of the `body` closure parameter.
136
- public borrowing func withLock <Result : ~ Copyable & Sendable , E : Error >(
137
- _ body : (transferring inout State) throws (E) -> Result
138
- ) throws (E) -> Result
137
+ public borrowing func withLock <Result : ~ Copyable , E : Error >(
138
+ _ body : (transferring inout State) throws (E) -> transferring Result
139
+ ) throws (E) -> transferring Result
139
140
140
141
/// Attempts to acquire the lock and then calls the given closure if
141
142
/// successful.
@@ -158,7 +159,8 @@ extension Mutex where State: ~Copyable {
158
159
/// - Warning: Recursive calls to `withLockIfAvailable` within the
159
160
/// closure parameter has behavior that is platform dependent.
160
161
/// Some platforms may choose to panic the process, deadlock,
161
- /// or leave this behavior unspecified.
162
+ /// or leave this behavior unspecified. This will never
163
+ /// reacquire the lock however.
162
164
///
163
165
/// - Parameter body: A closure with a parameter of `State`
164
166
/// that has exclusive access to the value being stored within
@@ -168,9 +170,9 @@ extension Mutex where State: ~Copyable {
168
170
///
169
171
/// - Returns: The return value, if any, of the `body` closure parameter
170
172
/// or nil if the lock couldn't be acquired.
171
- public borrowing func withLockIfAvailable <Result : ~ Copyable & Sendable , E : Error >(
172
- _ body : (transferring inout State) throws (E) -> Result?
173
- ) throws (E) -> Result?
173
+ public borrowing func withLockIfAvailable <Result : ~ Copyable , E : Error >(
174
+ _ body : (transferring inout State) throws (E) -> transferring Result?
175
+ ) throws (E) -> transferring Result?
174
176
}
175
177
```
176
178
0 commit comments