Skip to content

Instantly share code, notes, and snippets.

@SebastianBoldt
Created February 3, 2022 19:00
Show Gist options
  • Save SebastianBoldt/64b93849ac191c0ea0ab139389ba9837 to your computer and use it in GitHub Desktop.
Save SebastianBoldt/64b93849ac191c0ea0ab139389ba9837 to your computer and use it in GitHub Desktop.
let task = Task {
for i in 0..<1_000_000_000_000_000 {
try Task.checkCancellation()
print(i)
}
}
task.cancel()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment