Skip to content

Commit 32e0825

Browse files
Revise per tech review feedback.
Co-authored-by: Doug Gregor <[email protected]>
1 parent 0089134 commit 32e0825

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

stdlib/public/core/Sendable.swift

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
///
3232
/// To declare conformance to `Sendable` without any compiler enforcement,
3333
/// write `@unchecked Sendable`.
34-
/// You are responsible for the correctness of unchecked sendable types, for example, by protecting all access to its state with a lock or a queue.
34+
/// You are responsible for the correctness of unchecked sendable types,
35+
/// for example, by protecting all access to its state with a lock or a queue.
3536
/// Unchecked conformance to `Sendable` also disables enforcement
3637
/// of the rule that conformance must be in the same file.
3738
///
@@ -56,17 +57,32 @@
5657
///
5758
/// Otherwise, you need to declare conformance to `Sendable` explicitly.
5859
///
59-
/// ### Sendable Actors and Classes
60+
/// ### Sendable Actors
6061
///
61-
/// All actor types implicitly conform to `Sendable`.
62+
/// All actor types implicitly conform to `Sendable`
63+
/// because actors ensure that all access to their mutable state
64+
/// is performed sequentially.
65+
///
66+
/// ### Sendable Classes
6267
///
6368
/// To satisfy the requirements of the `Sendable` protocol,
64-
/// final classes must contain only immutable stored properties,
65-
/// and must either be a subclass of `NSObject` or have no superclass.
69+
/// a class must:
70+
///
71+
/// - Be marked `final`
72+
///
73+
/// - Contain only stored properties that are immutable and sendable
74+
///
75+
/// - Have no superclass or have `NSObject` as the superclass
76+
///
77+
/// Classes marked with `@MainActor` are implicitly sendable,
78+
/// because the main actor coordinates all access to its state.
79+
/// These classes can have stored properties that are mutable and nonsendable.
6680
///
67-
/// Other classes can be marked as `@unchecked Sendable`,
81+
/// Classes that don't meet the requirements above
82+
/// can be marked as `@unchecked Sendable`,
6883
/// disabling compile-time correctness checks,
69-
/// after you manually verify that they satisfy the semantic requirements.
84+
/// after you manually verify that
85+
/// they satisfy the `Sendable` protocol's semantic requirements.
7086
///
7187
/// ### Sendable Functions and Closures
7288
///

0 commit comments

Comments
 (0)