Producer Consumer Thread
i've got a problem can't resolve it, hope someone can help.
In few words i have a shared buffer, where both producer and consumer, put
and retreive items.
now say i have 4 producer thread producing 5 items each, and 3 consumer taking
those items out of the buffer.
now the prob is i don't know how to tell the consumer to stop retrieving
these items when all producer are done, it just waits forever.
bare in mind that comsumer doesn't know how many item are produced by the
procucer threads, the only thing they have in common, is the buffer.
i have tried few methods( i.e check wehn the buffer is empty, but this is
no working, coz it turns out to be true when a consumer takes the item as
soon as it's been produce) or is there a way i can put some sort of flag
in the buffer to say that the last has been retreived.
hope it makes sense,i'm just too confuse myself,
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL