Skip to content

Commit 919eb1d

Browse files
authored
Merge pull request #48 from lorentey/fix-UnsafeAtomic-Sendable
Fix `UnsafeAtomic`'s `Sendable` conformance
2 parents de1a622 + 44bf6b5 commit 919eb1d

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

Sources/Atomics/AtomicLazyReference.swift.gyb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ public struct UnsafeAtomicLazyReference<Instance: AnyObject> {
4747
}
4848
}
4949

50+
#if compiler(>=5.5) && canImport(_Concurrency)
51+
extension UnsafeAtomicLazyReference: @unchecked Sendable
52+
where Instance: Sendable {}
53+
#endif
54+
5055
extension UnsafeAtomicLazyReference {
5156
/// The storage representation for an atomic lazy reference value.
5257
@frozen

Sources/Atomics/HighLevelTypes.swift.gyb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ public struct UnsafeAtomic<Value: AtomicValue> {
7171
}
7272
}
7373

74+
#if compiler(>=5.5) && canImport(_Concurrency)
75+
extension UnsafeAtomic: @unchecked Sendable where Value: Sendable {}
76+
#endif
77+
7478
/// A reference type holding an atomic value, with automatic memory management.
7579
@_fixed_layout
7680
public class ManagedAtomic<Value: AtomicValue> {

Sources/Atomics/autogenerated/AtomicLazyReference.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ public struct UnsafeAtomicLazyReference<Instance: AnyObject> {
5050
}
5151
}
5252

53+
#if compiler(>=5.5) && canImport(_Concurrency)
54+
extension UnsafeAtomicLazyReference: @unchecked Sendable
55+
where Instance: Sendable {}
56+
#endif
57+
5358
extension UnsafeAtomicLazyReference {
5459
/// The storage representation for an atomic lazy reference value.
5560
@frozen

Sources/Atomics/autogenerated/HighLevelTypes.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ public struct UnsafeAtomic<Value: AtomicValue> {
7373
}
7474
}
7575

76+
#if compiler(>=5.5) && canImport(_Concurrency)
77+
extension UnsafeAtomic: @unchecked Sendable where Value: Sendable {}
78+
#endif
79+
7680
/// A reference type holding an atomic value, with automatic memory management.
7781
@_fixed_layout
7882
public class ManagedAtomic<Value: AtomicValue> {

0 commit comments

Comments
 (0)