Skip to content

[AsyncChannel] Question: is task cancellation in sending operations too violent? #182

Closed
@twittemb

Description

@twittemb

Hi @phausler

I was wondering if the task cancellation when sending an element in an AsyncChannel was not a bit too violent ?

This is the code when sending an element:

func _send(_ element: Element) async {
  await withTaskCancellationHandler {
    terminateAll()
  } operation: { ... }

the terminateAll() function will resume all the suspended operations (producers and consumers). What if the sending operations are performed in several Tasks? it means the async channel is finished for every one of them, which seem a bit violent right ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions