mirror of
https://github.com/apple/swift-async-algorithms
synced 2026-11-29 04:54:21 +00:00
Deprecation Housekeeping (#206)
`withTaskCancellationHandler<T>(_:, operation:)` -> `withTaskCancellationHandler<T>(operation:onCancel:)`
This commit is contained in:
1 parent
314b10c634
commit
1bd073999c
8 files changed
+35
-35
No files matched your search
@@ -39,10 +39,10 @@ public final class AsyncThrowingChannel<Element: Sendable, Failure: Error>: Asyn
|
||||
let nextTokenStatus = ManagedCriticalState<ChannelTokenStatus>(.new)
|
||||
|
||||
do {
|
||||
let value = try await withTaskCancellationHandler { [channel] in
|
||||
channel.cancelNext(nextTokenStatus, generation)
|
||||
} operation: {
|
||||
let value = try await withTaskCancellationHandler {
|
||||
try await channel.next(nextTokenStatus, generation)
|
||||
} onCancel: { [channel] in
|
||||
channel.cancelNext(nextTokenStatus, generation)
|
||||
}
|
||||
|
||||
if let value = value {
|
||||
@@ -295,10 +295,10 @@ public final class AsyncThrowingChannel<Element: Sendable, Failure: Error>: Asyn
|
||||
let generation = establish()
|
||||
let sendTokenStatus = ManagedCriticalState<ChannelTokenStatus>(.new)
|
||||
|
||||
await withTaskCancellationHandler { [weak self] in
|
||||
self?.cancelSend(sendTokenStatus, generation)
|
||||
} operation: {
|
||||
await withTaskCancellationHandler {
|
||||
await send(sendTokenStatus, generation, element)
|
||||
} onCancel: { [weak self] in
|
||||
self?.cancelSend(sendTokenStatus, generation)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user