News for hackers. Stuff that matters.
Re:Discipline Doesn’t Scale by jayd16 on Wednesday October 21, 2020 @03:58AM (#24845694)
I thought Java's locking worked fine as long as you didn't make your locks public or lock on `this`. What is Rust doing that's an improvement?
Re:Discipline Doesn’t Scale by raducu on Wednesday October 21, 2020 @06:47AM (#24846514)
What is wrong with locking on "this" ?

Making the locks public, I sort of get (like making any field public) -- you have multiple locks, you need to ensure they are accessed in a certain order and if you make them public, you cannot enforce that order.

Re:Discipline Doesn’t Scale by jayd16 on Wednesday October 21, 2020 @12:58PM (#24849710)
>What is wrong with locking on "this" ?

Instance.this is implicitly public because something else could have a reference to instance.

    synchronize(this){}
that will lock with the following if its inside instance.

    synchronize(instance){}