Boost logo

Boost :

Subject: Re: [boost] [Interprocess::Semaphore] Deadlock on more producers - one consumer problem
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2009-06-18 10:50:40

Cosimo Calabrese wrote:
> Is there a way to unlock all the producers with the
> boost::interprocess::semaphore? Or I have mistaken the approach of the
> problem?

If a semaphore count represents free resources, shouldn't post be
performed by the producer to signal available resources? You can try this:

semaphore fillCount = 0
semaphore emptyCount = BUFFER_SIZE

procedure producer() {
     while (true) {
         item = produceItem()

procedure consumer() {
     while (true) {
         item = removeItemFromBuffer()

where down is "wait" and up is "post".



Boost list run by bdawes at, gregod at, cpdaniel at, john at