5 ms·
> So why do have to manually mutex or semaphore your threads? This is not a type system with concurrency capabilities is meant for. You don't have to use mutex
by stymaar 10y ago
> So why do have to manually mutex or semaphore your threads? This is not a type system with concurrency capabilities is meant for.
You don't have to use mutex ! The Rust type system has two traits to ensure thread-safety : Send and Sync, and you can safely use anything which implement those traits. Mutex is one easy way to have these capabilities, but it's not the only one. You can build your own thread-safe data structure if you want, or even use third-party ones like crossbeam[1]. The compiler will then ensure that you never use non-thread-safe objects accross threads.
> At least parrot and pony do away without that nonsense.
What is parrot ? I've read about pony but not parrot, and Google isn't helping.
[1] : https://github.com/crossbeam-rs/crossbeam/blob/master/README.md https://github.com/crossbeam-rs/crossbeam/blob/master/README...