[concurrency-interest] Language extensions for java.util.concurrent?

Dawid Kurzyniec dawidk at mathcs.emory.edu
Thu Nov 10 03:02:34 EST 2005

Now, as the dust has settled and java.util.concurrent is a core library, 
I am wondering if the next step should be to propose language extensions 
to simplify usage of new tools, particularly locks and atomics? For 

class A {
  atomic int a;
  final Lock lock = new ReentrantLock();
  void foo() {
    ++a; // -> incrementAndGet()
    a ?= 5, 8; // ->compareAndSet(5, 8)
    lock.lock() { // ->lock(); try { ... } finally { unlock(); }
      // do stuff with the lock held

Precedence for interface-based syntax support has been set by the 
Iterable, and atomic is essentially a stronger incarnation of volatile. 
So why not?


More information about the Concurrency-interest mailing list