Re:Ditch your (mut)ex, you deserve better
by dist-epoch on Tuesday November 18, 2025 @04:08AM
(#45962973)
Sounds like the Java synchronized class.
[ Parent
| on HN ]
Re:Ditch your (mut)ex, you deserve better
by the_gipsy on Tuesday November 18, 2025 @06:14AM
(#45963681)
Not at all. With rust you cannot accidentally leak a reference, and here's the killer: it guarantees these properties at compile time.
Re:Ditch your (mut)ex, you deserve better
by masklinn on Tuesday November 18, 2025 @08:21AM
(#45965444)
No. It’s not a property of the type so you can have multiple items under a mutex and you’re not at the mercy of whoever wrote it, it works fine with POD types, it does not force a lock / unlock on each method call (instead the compiler essentially ensures you hold the lock before you can access the data), and the borrow checker is there to ensure you can not leak any sort of sub-states, even though you can call all sorts of helpers which have no requirement to be aware of the locking.
It’s what synchronized classes wish they had been, maybe.