What's the memory ordering on channels(std & crossbeam & futures)

Recently I read The Go memory Model, Go make some memory order guarantees on channels,

A send on a channel happens before the corresponding receive from that channel completes.

The closing of a channel happens before a receive that returns a zero value because the channel is closed.

A receive from an unbuffered channel happens before the send on that channel completes.

The k th receive on a channel with capacity C happens before the k + C th send from that channel completes.

Does rust channels(std & crossbeam & futures) have these properties.

Do the exact guarantees matter? Rust's channels uphold Rust's memory- and thread-safety properties with respect to ownership, Send & Sync.

1 Like

I think they do and this area is a bit subtle and fuzzy (unless docs have been changed somewhat recently). Awhile back @HadrienG and I had a discussion about Send/Sync and memory ordering, and what, if any, relationship/guarantees they provide. That then translated into this github issue, which may be useful fodder for some.