Pre-Proposal: Linguistic support for locks

Jesse Wilson jesse at swank.ca
Sun Mar 8 16:56:45 PDT 2009


On Sun, Mar 8, 2009 at 11:20 AM, Joshua Bloch <jjb at google.com> wrote:

>    try (<lock-expr>) {
>        <code>
>    }


try is definitely the wrong keyword here. Mostly because there's already a
method Lock.tryLock() that is not at all related to this sweet sugar.
http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/locks/Lock.html#tryLock()

  1. Use the protected keyword in place of try.
>

This is fantastic. I especially like that proper Locks would become just as
easy-to-use as the built-in monitor on Object.



More information about the coin-dev mailing list