Concurrent programming in Rust part 10

Publicado em: 17 Setembro 2023
no canal de: 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.


Nesta página do site você pode assistir ao vídeo on-line Concurrent programming in Rust part 10 duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Dario 17 Setembro 2023, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 863 vezes e gostou 38 espectadores. Boa visualização!