I am implementing a feature using the async/await based Tokio and Rust 1.39.0. I understand there can be performance implications with using the regular Mutex
from within an async context, but are there any other possible effects? For example, I remember reading somewhere it can lock up the thread pool/runtime or hang the system.
For context, the rest of our system is written in a synchronous way. I am looking at implementing the network facing part using the latest Tokio which would use tokio::sync::Mutex
and friends. It is possible that the asynchronous network component calls into the synchronous parts which try to take the sync::Mutex
.
Some options:
- Separate these parts via message passing
- Change parts of the rest of the system to be async aware, which would be a big undertaking.
I would like to avoid both if possible.