sclass IntVar { int a; // you can access this directly if you use one thread public synchronized void set(int v) { if (v != a) { a = v; notifyAll(); } } public synchronized int get() { ret a; } synchronized int waitForValue(int x) ctex { while (a != x) wait(); ret a; } toString { ret str(this!); } }