Closed sowbug closed 2 months ago
I think MIDI channels are just this.
The bus crate appears to be inactive, but not because it was a bad idea. I can't find the discussion right now, but I read that the crate ends up being fairly similar to keeping a Vec of subscriber sender channels and then sending to each when you want to broadcast something. There is a nice twist that avoids a Copy
on the final sender, because it can now take the original message, but otherwise it's similar to rolling your own. But this investigation did send me down a rabbit hole of actors/crossbeam channels, and I'm way better off than I was before. So I'm closing this issue, but it's had a big positive impact on the project.
https://crates.io/crates/bus
It's an SPMC queue, but unlike a work-stealer, it gives every message to every consumer.