File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 4
4
> This is in reverse chronological order, so newer entries are added to the top.
5
5
6
6
## Swift 5.11
7
+ * [SE-0417][]:
8
+ Tasks now gain the ability to respect Task Executor preference.
9
+ This allows tasks executing default actors (which do not declare a custom executor),
10
+ and nonisolated asynchronous functions to fall back to a preferred executor, rather than always
11
+ executing on the default global pool.
12
+
13
+ The executor preference may be stated using the `withTaskExecutorPreference` function:
14
+
15
+ ```swift
16
+ nonisolated func doSomething() async { ... }
17
+
18
+ await withTaskExecutorPreference(preferredExecutor) {
19
+ doSomething()
20
+ ```
21
+
22
+ Or when creating new unstructured or child-tasks (e.g. in a task group):
23
+
24
+ ```swift
25
+ Task(executorPreference: preferredExecutor) {
26
+ // executes on 'preferredExecutor'
27
+ await doSomething() // doSomething body would execute on 'preferredExecutor'
28
+ }
29
+ ```
7
30
8
31
* [SE-0413][]:
9
32
@@ -10080,6 +10103,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
10080
10103
[SE-0397]: https://github.com/apple/swift-evolution/blob/main/proposals/0397-freestanding-declaration-macros.md
10081
10104
[SE-0407]: https://github.com/apple/swift-evolution/blob/main/proposals/0407-member-macro-conformances.md
10082
10105
[SE-0411]: https://github.com/apple/swift-evolution/blob/main/proposals/0411-isolated-default-values.md
10106
+ [SE-0417]: https://github.com/apple/swift-evolution/blob/main/proposals/0417-task-executor-preference.md
10083
10107
[SE-0412]: https://github.com/apple/swift-evolution/blob/main/proposals/0412-strict-concurrency-for-global-variables.md
10084
10108
[SE-0413]: https://github.com/apple/swift-evolution/blob/main/proposals/0413-typed-throws.md
10085
10109
[#64927]: <https://github.com/apple/swift/issues/64927>
You can’t perform that action at this time.
0 commit comments