while (available == false) { try { wait(); } catch (InterruptedException e) { } } available = false; notifyAll(); return contents;
while (available == true) { try { wait(); } catch (InterruptedException e) { } } contents = value; available = true; notifyAll();