Concurrent programming in Rust part 10

Published: 17 September 2023
on channel: Dario
863
38

So you need to share an object between threads, what do you do?

Wrap it in an ArcMutex pointer and call it a day right?

Let's take it to the next level.

A very common pattern in rust is to hide the arc mutex pointer in an inner property and to implement the clone trait, that way you can just pass the object around by cloning it.

Just be careful, because every time you call a method in your SharedCache object you will be locking internally, which might lead to some race conditions.


On this page of the site you can watch the video online Concurrent programming in Rust part 10 with a duration of hours minute second in good quality, which was uploaded by the user Dario 17 September 2023, share the link with friends and acquaintances, this video has already been watched 863 times on youtube and it was liked by 38 viewers. Enjoy your viewing!