I have a multithread application where one of threads adding and deleting elements from HashMap and other few threads only reading from that map, so by logic it is guaranteed that other maps don’t have a writable access to that map.
I can implement this with
Arc<Mutex<HashMap<String, SomeData>>>, but in this case if some of the threads starting reading process, others would be waiting until Mutex will be reseted. I want to have a concurrent Reads and only one write access like
RwLock but for multiple threads.
In C++ I can actually just refer using pointer and make sure from logic that threads have read only access.
How can I implement this with Rust ? I couldn’t find any relevant information about this problem in documentation.
RwLock is fine but it’s not working with multiple threads.