2 ms·
> In most languages, the language says nothing about what data is protected by the mutex. Or the other way around, what mutex protects a piece of data (or even
by masklinn 12y ago
> In most languages, the language says nothing about what data is protected by the mutex.
Or the other way around, what mutex protects a piece of data (or even that a piece of data should be protected at all), so it's easy to forget it and just manipulate a bit of data without correctly locking it.
I was pleasantly surprised to discover that Rust's sync::Mutex owns the data it protects, so you can only access the data through the mutex (and the relation thus becomes obvious).