
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: http://en.wikipedia.org/wiki/Producer-consumer_problem#Using_semaphores semaphore fillCount = 0 semaphore emptyCount = BUFFER_SIZE procedure producer() { while (true) { item = produceItem() down(emptyCount) putItemIntoBuffer(item) up(fillCount) } } procedure consumer() { while (true) { down(fillCount) item = removeItemFromBuffer() up(emptyCount) consumeItem(item) } } where down is "wait" and up is "post". Best, Ion