On 01/13/2014 06:48 PM, Brian Anderson wrote:

# Synchronous and bounded channels

Let's add `SyncChan` which is a bounded multi-producer single-consumer queue backed by a ring buffer. This supports `send`, which blocks by default, and `try_send` which returns an enum representing whether the send succeeded, the channel is full, or the channel is closed (the last two cases returning the message). In the special case where the channel bound is 0, we don't use a ringbuffer and just do a rendezvousing send and recieve. The default bound is 0.

One of the reasons for making sync and async channels different types is so that somebody who is given a channel object knows the semantics they are dealing with. It occurred to me today that the 0-bound case and the N-bound case for sync channels also has this problem. With no buffer you are always expecting to rendezvous with the receiver, but the type doesn't give you that guarantee. It seems to me these are pretty different use cases and I'm worried about combining them.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to