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
The case where bound == 0 is actually made explicit:
Note that a buffer size of 0 is valid, in which case this becomes "rendezvous channel" where each send will not return until a recv is paired with it.
I think that this should not be discarded as "not useful". The reason is that, with a buffer size of 0, this library can be used effectively (for example) to sync threads. By waiting for all receivers to read, a sender can ensure that all the receivers are in the expected state. mpsc can do that, but it's significantly slower.
The text was updated successfully, but these errors were encountered:
Using bound == 0 as a synchronizing channel makes a lot of sense, though unfortunately (as I referenced in that issue), making the implementation support this use-case is actually fairly tricky. Happy to take a look at a PR if you want to take a stab at implementing it though!
(This is related to #7, however, that treats a buffer size of 0 as inappropriate value, here it's to discuss its usefulness).
The stdlib
mpsc
module has async_channel(bound: usize)
](https://doc.rust-lang.org/std/sync/mpsc/fn.sync_channel.html) method.The case where
bound == 0
is actually made explicit:I think that this should not be discarded as "not useful". The reason is that, with a buffer size of 0, this library can be used effectively (for example) to sync threads. By waiting for all receivers to read, a sender can ensure that all the receivers are in the expected state. mpsc can do that, but it's significantly slower.
The text was updated successfully, but these errors were encountered: