public void put(string s) { lock (this) { while (q.Count == capacity) { Monitor.Wait(this); }; q.Enqueue(s); Monitor.PulseAll(this); } }