AsyncChannel
can only provide backpressure between two Swift Task
s. If you are producing from a non-async
context then it cannot be used. This is because AsyncChannel.send
is async
. This is not true of AsyncStream.Continuation
or this proposal here, which can both be used from non-async
contexts.
Additionally, AsyncChannel
has an effective internal buffer size of 1: a call to send
suspends until the value is dequeued from next
. That's not always optimal.