Last active
August 24, 2025 11:51
-
-
Save juanarzola/09b2749fcc540a579fcb24d718459e24 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public extension Task where Success == Void , Failure == Never { | |
// Suspends until the task is cancelled | |
static func cancellation() async -> Void { | |
let s = AsyncStream<Void>{ continuation in } | |
for await _ in s { | |
} | |
} | |
// EMITS INFINITE ELEMENTS CPU 100% | |
static func cancellation() async -> Void { | |
let s = AsyncStream<Void>{ } | |
for await _ in s { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment