You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe Sender::send() is not cancel safe in regard that it takes ownership of the value to be sent. If the future is cancelled, the value is gone with no way to recover it. This makes using it inconvenient within the select! loop.
tokio's mpsc::Sender suggests using reserve() and Permit::send() to resolve this problem. reserve() returns a future, but it does not consume any value by itself. Permit::send() then can be used to send the value without any blocking.
Can a similar API be implemented for async-channel? Is that feasible?
Support would need to be added to the underlying concurrent-queue crate... which may be a lot harder in practice. I'd accept PRs but we would first need to come up with the underlying algorithm.
I believe
Sender::send()
is not cancel safe in regard that it takes ownership of the value to be sent. If the future is cancelled, the value is gone with no way to recover it. This makes using it inconvenient within theselect!
loop.tokio's
mpsc::Sender
suggests usingreserve()
andPermit::send()
to resolve this problem.reserve()
returns a future, but it does not consume any value by itself.Permit::send()
then can be used to send the value without any blocking.Can a similar API be implemented for async-channel? Is that feasible?
[1] https://docs.rs/tokio/latest/tokio/macro.select.html
[2] https://docs.rs/tokio/latest/tokio/sync/mpsc/struct.Sender.html#cancel-safety
The text was updated successfully, but these errors were encountered: