Unsafe: removing the monitorEnter/monitorExit/tryMonitorEnter methods
David Holmes
david.holmes at oracle.com
Mon Mar 3 06:52:57 UTC 2014
On 27/02/2014 11:56 PM, Vitaly Davidovich wrote:
> Right, there's no such guarantee/requirement. JVMS mentions that
> implementations are permitted to enforce balance (called structured locking
> there) but not required:
> http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-2.html#jvms-2.11.10
And this proposal would make it impossible to enforce balanced locking.
When we defined the Lock API we thought about whether/how Locks and
built-in monitors might interact and the decision was to keep them
completely distinct.
David
> Thanks
>
> Sent from my phone
> On Feb 27, 2014 8:40 AM, "Jeroen Frijters" <jeroen at sumatra.nl> wrote:
>
>> David Holmes wrote:
>>> I don't think this is workable. Exposing a monitor as Lock would allow
>>> you to break the guarantees/requirements involving balanced-locking for
>>> monitors.
>>
>> Where are these guarantees/requirements documented?
>>
>> Regards,
>> Jeroen
>>
>>
More information about the core-libs-dev
mailing list