-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Can we add a cancelAllOperations() method?
Currently, this conflicts with the fact that the perform methods prefer running in the current task:
// AsyncQueues 0.3.0
let queue = AsyncQueue()
await queue.perform {
// In the same task as the caller
}For cancelAllOperations() to work, we'd need to run those operations in a distinct task:
// With hypothetic support for cancelling all operations
let queue = AsyncQueue()
await queue.perform {
// Must be in a distinct task than the caller
// so that we can cancel this operation.
}This would be a breaking change:
let queue = AsyncQueue()
await queue.perform {
// Would not cancel the same task
withUnsafeCurrentTask { currentTask in
currentTask?.cancel()
}
}cc @mattmassicotte - in case you'd have hindsights about the differences between running in the current task vs. a new top-level Task created from the current task, and why one could prefer one or the other.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request