File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
stdlib/public/Synchronization/Mutex Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,10 @@ public struct Mutex<Value: ~Copyable>: ~Copyable {
52
52
public init ( _ initialValue: consuming Value ) {
53
53
value = _Cell ( initialValue)
54
54
}
55
+ }
55
56
57
+ @available ( SwiftStdlib 6 . 0 , * )
58
+ extension Mutex {
56
59
/// Attempts to acquire the lock and then calls the given closure if
57
60
/// successful.
58
61
///
@@ -204,5 +207,29 @@ public struct Mutex<Value: ~Copyable>: ~Copyable {
204
207
}
205
208
}
206
209
210
+ @available ( SwiftStdlib 6 . 0 , * )
211
+ extension Mutex where Value == Void {
212
+ @available ( SwiftStdlib 6 . 0 , * )
213
+ @_alwaysEmitIntoClient
214
+ @_transparent
215
+ public borrowing func _unsafeLock( ) {
216
+ handle. lock ( )
217
+ }
218
+
219
+ @available ( SwiftStdlib 6 . 0 , * )
220
+ @_alwaysEmitIntoClient
221
+ @_transparent
222
+ public borrowing func _unsafeTryLock( ) -> Bool {
223
+ handle. tryLock ( )
224
+ }
225
+
226
+ @available ( SwiftStdlib 6 . 0 , * )
227
+ @_alwaysEmitIntoClient
228
+ @_transparent
229
+ public borrowing func _unsafeUnlock( ) {
230
+ handle. unlock ( )
231
+ }
232
+ }
233
+
207
234
@available ( SwiftStdlib 6 . 0 , * )
208
235
extension Mutex : @unchecked Sendable where Value: Sendable { }
You can’t perform that action at this time.
0 commit comments