|
|
|
|
|
by wongarsu
697 days ago
|
|
> The data going into each "mailbox" either needs to be immutable, or deep copied to be thread safe Or moved. The mailbox/process pattern works great in Rust because you can simply move ownership of a value. Kind of like if in C you send the pointer and then delete your copy. Of course doing this across threads doesn't work with every type of value (what Rust's type system encodes as a value being `Send`). For example you can't send a reference-counted value if the reference counter isn't thread-safe. But that's rarely an issue and easily solved with a good type system. |
|