Are there downsides to 'static channels?

When working with channels, such as those in std::sync::mpsc, crossbeam, or embassy-sync, are there reasons why one should avoid instantiating the channels as static items?

This is an open-ended question, for which I apologize, and in most cases I can avoid worrying about this. However, when working with embassy-sync sometimes it's easier to create the channel as a static item because the corresponding Senders and Receivers seem to include a reference to said channel.

I'd also appreciate any links where I can read more about using channels properly.

I mean, it has all the usual disadvantages of global variables. But if you are doing embedded stuff, then globals are justified more often.

As for links about channels, I have a blog post about them: actors with Tokio

1 Like

Thank you Alice, and your link was super helpful!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.