|
45 | 45 | @_spi(Private) |
46 | 46 | public func withIdentifiableContinuation<T>( |
47 | 47 | isolation: isolated some Actor, |
| 48 | + function: String = #function, |
48 | 49 | body: (IdentifiableContinuation<T, Never>) -> Void, |
49 | 50 | onCancel handler: @Sendable (IdentifiableContinuation<T, Never>.ID) -> Void |
50 | 51 | ) async -> T { |
51 | 52 | let id = IdentifiableContinuation<T, Never>.ID() |
52 | 53 | let state = AllocatedLock(initialState: (isStarted: false, isCancelled: false)) |
53 | 54 | return await withTaskCancellationHandler { |
54 | | - await withCheckedContinuation { |
| 55 | + await withCheckedContinuation(function: function) { |
55 | 56 | let continuation = IdentifiableContinuation(id: id, continuation: $0) |
56 | 57 | body(continuation) |
57 | 58 | let sendCancel = state.withLock { |
@@ -90,13 +91,14 @@ public func withIdentifiableContinuation<T>( |
90 | 91 | @_spi(Private) |
91 | 92 | public func withIdentifiableThrowingContinuation<T>( |
92 | 93 | isolation: isolated some Actor, |
| 94 | + function: String = #function, |
93 | 95 | body: (IdentifiableContinuation<T, any Error>) -> Void, |
94 | 96 | onCancel handler: @Sendable (IdentifiableContinuation<T, any Error>.ID) -> Void |
95 | 97 | ) async throws -> T { |
96 | 98 | let id = IdentifiableContinuation<T, any Error>.ID() |
97 | 99 | let state = AllocatedLock(initialState: (isStarted: false, isCancelled: false)) |
98 | 100 | return try await withTaskCancellationHandler { |
99 | | - try await withCheckedThrowingContinuation { |
| 101 | + try await withCheckedThrowingContinuation(function: function) { |
100 | 102 | let continuation = IdentifiableContinuation(id: id, continuation: $0) |
101 | 103 | body(continuation) |
102 | 104 | let sendCancel = state.withLock { |
|
0 commit comments