Sunday, June 17, 2001 06:14 PM
You just described a blocking queue. Search this FAQ for more information.
(See the little box labeled "Search" in the upper-right corner? That's for searching. For instance, I type in "producer consumer" and I get three hits, one of which contains full source code for solving your problem.)
By the way, if this is trolling for the answer for a final exam, I'll be very disappointed... :-)