usagi / rust-memory-container-cs

Rust Memory Container Cheat-sheet
MIT License
2.37k stars 80 forks source link

Question about the multiple/unique branch #8

Open lengyijun opened 3 years ago

lengyijun commented 3 years ago

I love this project and I use it as wallpaper. But I have a question about the multiple/unique branch. I feel this branch is unnecessay. I feel Mutex should always be used inside Arc. Mutex are never used alone. If there are any example where Mutex is needed in a single thread?

I'm new to Rust and I may confuse something.

Nytelife26 commented 3 years ago

Mutex in the graph is under the multiple threads branch. I think you may be reading the graph wrong. Mutexes are indeed used outside of Arc and other structures quite a lot, but no, never in single threads - which is why it's under the multiple threads branch.