Merge pull request #46 from lorentey/sendable

Mark managed atomic constructs Sendable if their payloads are
This commit is contained in:
Karoy Lorentey authored and GitHub committed 2023-03-17 14:41:13 -07:00
commit a79166d648
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
+3
View File
@@ -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