On Mar 4, 2014, at 7:41 PM, David Holmes <david.hol...@oracle.com> wrote:

> I agree it is as unsafe as using Lock. I think not being able to forget to 
> unlock a monitor is more than just convenient. YMMV and obviously does.

That's why that "unsafe" kind of stuff currently lives in class "unsafe".

Next there are safe ways to build on those primitives to create safe APIs, 
using encapsulation and access restriction.

The "Runnable" trick for matching monitors is (probably) compatible with 
low-level unsafe unmatched monitor operations.

Another metaphor:  It's OK to build an office building using tools that the 
office workers won't have daily access to.  Construction sites have different 
safety rules than office environments.  Some folks get to use nailguns at work; 
I don't, but that doesn't make me want my building to be constructed using 
staplers only.

— John

Reply via email to