Skip to content

Commit b093edc

Browse files
committed
AsyncBufferedChannel: use checked continuations
1 parent 83992aa commit b093edc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/AsyncChannels/AsyncBufferedChannel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public final class AsyncBufferedChannel<Element>: AsyncSequence, Sendable {
3535

3636
struct Awaiting: Hashable {
3737
let id: Int
38-
let continuation: UnsafeContinuation<Element?, Never>?
38+
let continuation: CheckedContinuation<Element?, Never>?
3939

4040
static func placeHolder(id: Int) -> Awaiting {
4141
Awaiting(id: id, continuation: nil)
@@ -178,7 +178,7 @@ public final class AsyncBufferedChannel<Element>: AsyncSequence, Sendable {
178178

179179
awaiting?.continuation?.resume(returning: nil)
180180
} operation: {
181-
await withUnsafeContinuation { [state] (continuation: UnsafeContinuation<Element?, Never>) in
181+
await withCheckedContinuation { [state] (continuation: CheckedContinuation<Element?, Never>) in
182182
let decision = state.withCriticalRegion { state -> AwaitingDecision in
183183
let isCancelled = cancellation.withCriticalRegion { $0 }
184184
guard !isCancelled else { return .resume(nil) }

0 commit comments

Comments
 (0)