mirror of
https://github.com/apple/swift-atomics
synced 2026-11-29 05:04:21 +00:00
Merge pull request #46 from lorentey/sendable
Mark managed atomic constructs Sendable if their payloads are
This commit is contained in:
4 files changed
+16
No files matched your search
@@ -152,6 +152,11 @@ public class ManagedAtomicLazyReference<Instance: AnyObject> {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=5.5) && canImport(_Concurrency)
|
||||
extension ManagedAtomicLazyReference: @unchecked Sendable
|
||||
where Instance: Sendable {}
|
||||
#endif
|
||||
|
||||
% for type in ["UnsafeAtomicLazyReference", "ManagedAtomicLazyReference"]:
|
||||
extension ${type} {
|
||||
/// Atomically initializes this reference if its current value is nil, then
|
||||
|
||||
@@ -99,6 +99,9 @@ public class ManagedAtomic<Value: AtomicValue> {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=5.5) && canImport(_Concurrency)
|
||||
extension ManagedAtomic: @unchecked Sendable where Value: Sendable {}
|
||||
#endif
|
||||
|
||||
% for type in ["UnsafeAtomic", "ManagedAtomic"]:
|
||||
extension ${type} {
|
||||
|
||||
@@ -155,6 +155,11 @@ public class ManagedAtomicLazyReference<Instance: AnyObject> {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=5.5) && canImport(_Concurrency)
|
||||
extension ManagedAtomicLazyReference: @unchecked Sendable
|
||||
where Instance: Sendable {}
|
||||
#endif
|
||||
|
||||
extension UnsafeAtomicLazyReference {
|
||||
/// Atomically initializes this reference if its current value is nil, then
|
||||
/// returns the initialized value. If this reference is already initialized,
|
||||
|
||||
@@ -101,6 +101,9 @@ public class ManagedAtomic<Value: AtomicValue> {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=5.5) && canImport(_Concurrency)
|
||||
extension ManagedAtomic: @unchecked Sendable where Value: Sendable {}
|
||||
#endif
|
||||
|
||||
extension UnsafeAtomic {
|
||||
/// Atomically loads and returns the current value, applying the specified
|
||||
|
||||
Reference in new issue
Block a user