swift-async-algorithms
swift-async-algorithms copied to clipboard
[Channel] improve send cancellation
This PR aims to:
- harmonize the cancellation handling for the
next()andsend()operations. Previously, asend()cancellation was terminating all the pending and awaiting operations, which seemed wrong to me as mentioned here https://github.com/apple/swift-async-algorithms/issues/182. - improve the readability of the cancellation in the case it happens before the operation (send/next). Previously, a "cancelled"
nextwas added to the awaiting list, so it can be immediately removed by the operation handling. Although it seemed to work well, it was not obvious when reading the code, and I tried to make it more explicit, so the maintenance is easier.