44
44
@_unsafeInheritExecutor
45
45
public func withIdentifiableContinuation< T> (
46
46
isolation: isolated some Actor ,
47
+ function: String = #function,
47
48
body: ( IdentifiableContinuation < T , Never > ) -> Void ,
48
49
onCancel handler: @Sendable ( IdentifiableContinuation < T , Never > . ID ) -> Void
49
50
) async -> T {
50
51
let id = IdentifiableContinuation < T , Never > . ID ( )
51
52
let state = AllocatedLock ( initialState: ( isStarted: false , isCancelled: false ) )
52
53
return await withTaskCancellationHandler {
53
- await withCheckedContinuation {
54
+ await withCheckedContinuation ( function : function ) {
54
55
let continuation = IdentifiableContinuation ( id: id, continuation: $0)
55
56
body ( continuation)
56
57
let sendCancel = state. withLock {
@@ -88,13 +89,14 @@ public func withIdentifiableContinuation<T>(
88
89
@_unsafeInheritExecutor
89
90
public func withIdentifiableThrowingContinuation< T> (
90
91
isolation: isolated some Actor ,
92
+ function: String = #function,
91
93
body: ( IdentifiableContinuation < T , any Error > ) -> Void ,
92
94
onCancel handler: @Sendable ( IdentifiableContinuation < T , any Error > . ID ) -> Void
93
95
) async throws -> T {
94
96
let id = IdentifiableContinuation < T , any Error > . ID ( )
95
97
let state = AllocatedLock ( initialState: ( isStarted: false , isCancelled: false ) )
96
98
return try await withTaskCancellationHandler {
97
- try await withCheckedThrowingContinuation {
99
+ try await withCheckedThrowingContinuation ( function : function ) {
98
100
let continuation = IdentifiableContinuation ( id: id, continuation: $0)
99
101
body ( continuation)
100
102
let sendCancel = state. withLock {
@@ -123,7 +125,6 @@ public struct IdentifiableContinuation<T, E>: Sendable, Identifiable where E: Er
123
125
124
126
public final class ID : Hashable , Sendable {
125
127
126
- @usableFromInline
127
128
init ( ) { }
128
129
129
130
public func hash( into hasher: inout Hasher ) {
@@ -135,7 +136,6 @@ public struct IdentifiableContinuation<T, E>: Sendable, Identifiable where E: Er
135
136
}
136
137
}
137
138
138
- @usableFromInline
139
139
init ( id: ID , continuation: CheckedContinuation < T , E > ) {
140
140
self . id = id
141
141
self . continuation = continuation
0 commit comments