All pastes #143086 Raw Edit

Mine

public text v1 · immutable
#143086 ·published 2006-08-21 21:28 UTC
rendered paste body
class Message {
		public String contents;
		}

	class Box {
		private Message m;
		private int p;
		public Box() {p=10;}
		public synchronized void one(Message x) {
			while (p<10) wait();
			m.contents=x.contents; p=0;
		}
		public synchronized void two(Message x) {
			x.contents=m.contents; p=p+1;
			if (p==10) notifyAll();
		}
	}