3 ms·
> you pay the overhead for the thread safety every time you use the object wether you need to or not. That’s not correct. See, eg, `Mutex::get_mut` (https://do
by matklad 5y ago
> you pay the overhead for the thread safety every time you use the object wether you need to or not.
That’s not correct. See, eg, `Mutex::get_mut` (https://doc.rust-lang.org/stable/std/sync/struct.Mutex.html#method.get_mut https://doc.rust-lang.org/stable/std/sync/struct.Mutex.html#...). It gives access to the underlying data without any locks or synchronization, if you can prove that no other threads ca access the mutex concurrently at the point of call.