static class LockedVar implements IVar {
A v; // you can access this directly if you use one thread
transient Lock lock = lock();
*() {}
*(A *v) {}
public void set(A a) {
lock lock;
v = a;
}
public A get() { lock lock; ret v; }
public bool has() { lock lock; ret v != null; }
public void clear() { lock lock; v = null; }
toString { ret str(get()); }
}