Subj : Re: many producers/one consumer To : comp.programming.threads From : Joe Seigh Date : Thu Feb 17 2005 08:00 am On Wed, 16 Feb 2005 23:51:17 -0500, Keith O wrote: > Hi, > > I have a many producers(threads) that add data to a queue and one > consumer(thread) that reads from the queue and writes the data to a > database. > > What is a good algorithm to handle this sort of thing. The thing that's > bugging me is when the producers finish producing data and exit, I want the > consumer to know that it should stop checking for new data and exit. > You'd use the same technique that you'd use for a signle threaded program to indicate no more data. -- Joe Seigh .