• 16 Posts
  • 523 Comments
Joined 2 years ago
cake
Cake day: October 8th, 2023

help-circle








  • So having read this I think that Rust’s MPSC might be the best message passing option. Note that I don’t know Go or Erlang, but the main problems highlighted in the article (deadlocks and memory leaks) are non-issues with MPSC.
    recv will always block until a new message is available or return an error when all senders have hung up.
    recv_timeout does the same but you can specify a timeout if indefinite blocking is unwanted.
    The sending end likewise will return an error if the receiving end has hung up.
    Sending is not blocking tho, so if sending doesn’t return an error, a receiver will eventually receive the message, and the sending process won’t be blocked if say the receiver is slow to process messages.

    Anyway bottom line is I think it’s a bit weird that the author doesn’t even mention Rust once.