Skip to content

Commit 61e179d

Browse files
committed
changelog: nonisolated async funcs may run on caller isolation now
1 parent a27cf87 commit 61e179d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,33 @@
5454
// do something
5555
}
5656
```
57+
* [SE-0461][]:
58+
Nonisolated asynchronous functions may now execute on the calling actor, when the upcoming feature `NonisolatedNonsendingByDefault`
59+
is enabled, or when explicitly opted-into using the `nonisolated(nonsending)` keywords. This allows for fine grained control
60+
over where nonisolated asynchronous functions execute, and allows for the default behavior of their execution to be changed
61+
from always executing on the global concurrent pool, to the calling actor, which can yield noticeable performance improvements
62+
thanks to less executor hopping when nonisolated and isolated code is invoked in sequence.
63+
64+
This also allows for safely using asynchronous functions on non-sendable types from actors, like so:
65+
66+
```swift
67+
class NotSendable {
68+
func performSync() { ... }
69+
70+
nonisolated(nonsending)
71+
func performAsync() async { ... }
72+
}
73+
74+
actor MyActor {
75+
let x: NotSendable
76+
77+
func call() async {
78+
x.performSync() // okay
79+
80+
await x.performAsync() // okay
81+
}
82+
}
83+
```
5784

5885
* The Swift compiler no longer diagnoses references to declarations that are
5986
potentially unavailable because the platform version might not be new enough
@@ -10837,6 +10864,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
1083710864
[SE-0442]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0442-allow-taskgroup-childtaskresult-type-to-be-inferred.md
1083810865
[SE-0444]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md
1083910866
[SE-0458]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0458-strict-memory-safety.md
10867+
[SE-0461]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0461-async-function-isolation.md
1084010868
[SE-0462]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0462-task-priority-escalation-apis.md
1084110869
[SE-0469]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0469-task-names.md
1084210870
[SE-0470]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0470-isolated-conformances.md

0 commit comments

Comments
 (0)