mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Adopt transferring for Mutex init
This commit is contained in:
@@ -75,6 +75,7 @@ set(SWIFT_SYNCHRNOIZATION_SWIFT_FLAGS
|
|||||||
"-enable-builtin-module"
|
"-enable-builtin-module"
|
||||||
"-enable-experimental-feature" "RawLayout"
|
"-enable-experimental-feature" "RawLayout"
|
||||||
"-enable-experimental-feature" "StaticExclusiveOnly"
|
"-enable-experimental-feature" "StaticExclusiveOnly"
|
||||||
|
"-enable-experimental-feature" "TransferringArgsAndResults"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_swift_target_library(swiftSynchronization ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
|
add_swift_target_library(swiftSynchronization ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public struct Mutex<Value: ~Copyable>: ~Copyable {
|
|||||||
@available(SwiftStdlib 6.0, *)
|
@available(SwiftStdlib 6.0, *)
|
||||||
@_alwaysEmitIntoClient
|
@_alwaysEmitIntoClient
|
||||||
@_transparent
|
@_transparent
|
||||||
public init(_ initialValue: consuming Value) {
|
public init(_ initialValue: transferring consuming Value) {
|
||||||
value = _Cell(initialValue)
|
value = _Cell(initialValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ extension Mutex where Value: ~Copyable {
|
|||||||
/// }
|
/// }
|
||||||
/// return try body(&value)
|
/// return try body(&value)
|
||||||
///
|
///
|
||||||
/// - Note: This version of `withLock` is unchecked because it does
|
/// - Note: This version of `tryWithLock` is unchecked because it does
|
||||||
/// not enforce any sendability guarantees.
|
/// not enforce any sendability guarantees.
|
||||||
///
|
///
|
||||||
/// - Warning: Recursive calls to `tryWithLockUnchecked` within the
|
/// - Warning: Recursive calls to `tryWithLockUnchecked` within the
|
||||||
|
|||||||
Reference in New Issue
Block a user