File tree Expand file tree Collapse file tree 2 files changed +23
-8
lines changed
Tests/AtomsTests/Utilities Expand file tree Collapse file tree 2 files changed +23
-8
lines changed Original file line number Diff line number Diff line change 22internal final class ScopeState {
33 let token = ScopeKey . Token ( )
44
5+ #if !hasFeature(IsolatedDefaultValues)
6+ nonisolated init ( ) { }
7+ #endif
8+
59 #if compiler(>=6)
610 var unregister : ( @MainActor ( ) -> Void ) ?
711
@@ -15,7 +19,7 @@ internal final class ScopeState {
1519 #else
1620 private var _unregister = UnsafeUncheckedSendable < ( @MainActor ( ) -> Void ) ? > ( nil )
1721
18- var unsubscribe : ( @MainActor ( ) -> Void ) ? {
22+ var unregister : ( @MainActor ( ) -> Void ) ? {
1923 _read { yield _unregister. value }
2024 _modify { yield & _unregister. value }
2125 }
Original file line number Diff line number Diff line change @@ -137,12 +137,23 @@ extension TransactionState {
137137}
138138
139139extension Task where Success == Never , Failure == Never {
140- static func yield(
141- isolation: isolated ( any Actor ) ? = #isolation,
142- @_inheritActorContext until predicate: @Sendable ( ) -> Bool
143- ) async {
144- while !predicate( ) {
145- await yield ( )
140+ #if compiler(>=6)
141+ static func yield(
142+ isolation: isolated ( any Actor ) ? = #isolation,
143+ @_inheritActorContext until predicate: @Sendable ( ) -> Bool
144+ ) async {
145+ while !predicate( ) {
146+ await yield ( )
147+ }
146148 }
147- }
149+ #else
150+ @MainActor
151+ static func yield(
152+ @_inheritActorContext until predicate: @Sendable ( ) -> Bool
153+ ) async {
154+ while !predicate( ) {
155+ await yield ( )
156+ }
157+ }
158+ #endif
148159}
You can’t perform that action at this time.
0 commit comments