Hi all,
Im writing a concurrent access queue. MY problem is that my producer is too much faster than the consumer, and the queue is allways filling up. I think that I have to write some congestion control, but sith sleeps? mutex?
One curious thing, if i write something like this:
void congestionControl (){
std::stringstream logMessage;
int pct=(messageQueue.size()*100)/maxQueueSize;
if (pct>=LEVEL4_PERCENT_MESSAGES_READY){
logMessage << "Aplying congestion control";
LOG4CXX_DEBUG(logger,logMessage.str());
sleep (1);
}
}
If the sleep command is 1, the consumer allways can consum its messages, but if I write sleep (0.99) it cant. Why? any idea?
regards