On 5/31/12 7:49 AM, Dmitry Olshansky wrote:

But this is a protection/visibility issue, which is orthogonal on the
locking capability. It's as if you say "int is not good because anyone
can overflow it." Okay! Make it private inside a CheckedInt class.

Sorry, that's a bad comparison. CheckedInt is to int, what CheckedMutex
is to mutex - but I'm not suggesting anything like a CheckedMutex. I'm
suggesting "mutex" but kept private inside the class /that it locks/.
Yes, it's a visibility issue, the issue is that the mutex used by
synchronized classes/methods is too visible/accessible and this opens it
up for deadlocks which are otherwise impossible.


Sure it's awful comparison.

It's a great comparison.

Andrei

Reply via email to