@@ -76,38 +76,49 @@ public protocol SerialExecutor: Executor {
7676 /// executor references.
7777 func asUnownedSerialExecutor( ) -> UnownedSerialExecutor
7878
79- /// If this executor has complex equality semantics, and the runtime needs to compare
80- /// two executors, it will first attempt the usual pointer-based equality check,
81- /// and if it fails it will compare the types of both executors, if they are the same,
82- /// it will finally invoke this method, in an attempt to let the executor itself decide
83- /// if this and the `other` executor represent the same serial, exclusive, isolation context.
79+ /// If this executor has complex equality semantics, and the runtime needs to
80+ /// compare two executors, it will first attempt the usual pointer-based
81+ /// equality / check, / and if it fails it will compare the types of both
82+ /// executors, if they are the same, / it will finally invoke this method,
83+ /// in an
84+ /// attempt to let the executor itself decide / if this and the `other`
85+ /// executor represent the same serial, exclusive, isolation context.
8486 ///
85- /// This method must be implemented with great care, as wrongly returning `true` would allow
86- /// code from a different execution context (e.g. thread) to execute code which was intended
87- /// to be isolated by another actor.
87+ /// This method must be implemented with great care, as wrongly returning
88+ /// `true` would allow / code from a different execution context (e.g. thread)
89+ /// to execute code which was intended to be isolated by another actor.
8890 ///
8991 /// This check is not used when performing executor switching.
9092 ///
91- /// This check is used when performing ``Actor/assertIsolated()``, ``Actor/preconditionIsolated()``,
92- /// ``Actor/assumeIsolated()`` and similar APIs which assert about the same "exclusive serial execution context".
93+ /// This check is used when performing ``Actor/assertIsolated()``,
94+ /// ``Actor/preconditionIsolated()``, ``Actor/assumeIsolated()`` and similar
95+ /// APIs which assert about the same "exclusive serial execution context".
9396 ///
9497 /// - Parameter other: the executor to compare with.
95- /// - Returns: true, if `self` and the `other` executor actually are mutually exclusive
96- /// and it is safe–from a concurrency perspective–to execute code assuming one on the other.
98+ /// - Returns: `true`, if `self` and the `other` executor actually are
99+ /// mutually exclusive and it is safe–from a concurrency
100+ /// perspective–to execute code assuming one on the other.
97101 @available ( SwiftStdlib 5 . 9 , * )
98102 func isSameExclusiveExecutionContext( other: Self ) -> Bool
99103}
100104
101105/// An executor that may be used as preferred executor by a task.
102106///
103107/// ### Impact of setting a task executor preference
104- /// By default, without setting a task executor preference, nonisolated asynchronous functions,
105- /// as well as methods declared on default actors -- that is actors which do not require a specific executor --
106- /// execute on Swift's default global concurrent executor. This is an executor shared by the entire runtime
107- /// to execute any work which does not have strict executor requirements.
108+ /// By default, without setting a task executor preference, nonisolated
109+ /// asynchronous functions, as well as methods declared on default actors --
110+ /// that is actors which do not require a specific executor -- execute on
111+ /// Swift's default global concurrent executor. This is an executor shared by
112+ /// the entire runtime to execute any work which does not have strict executor
113+ /// requirements.
108114///
109- /// By setting a task executor preference, either with a ``_withTaskExecutor(_:operation:)``, creating
110- /// a task with a preference (`Task(_on:)`), or
115+ /// By setting a task executor preference, either with a
116+ /// ``_withTaskExecutor(_:operation:)``, creating a task with a preference
117+ /// (`Task(_on:)`, or `group.addTask(on:)`), the task and all of its child
118+ /// tasks (unless a new preference is set) will be preferring to execute on
119+ /// the provided task executor.
120+ ///
121+ /// Unstructured tasks do not inherit the task executor.
111122@_unavailableInEmbedded
112123@available ( SwiftStdlib 9999 , * )
113124public protocol _TaskExecutor : Executor {
0 commit comments