3 ms·
> What would you say is an "easy" way to deal with concurrency? Handle threading, memory visibility issues, locking, etc yourself? Message queues, with workers
by lelanthran 5y ago
> What would you say is an "easy" way to deal with concurrency? Handle threading, memory visibility issues, locking, etc yourself?
Message queues, with workers atomically reading messages of a single queue, and placing responses on another queue.
Sure, it's not as flexible as starting threads[1], but 99 times out of a 100 you can use message queues and there's literally no race condition to happen, no memory visibility issues, no locking, etc.
[1] Some solutions, such as those that games employ, are rarely able to implement concurrency with just message queues, but to be honest if your problem is such that you can only employ solutions that require global state to be modified by several threads, then Rust, and similar 'safe' languages aren't usable there either.