I have a problem with producers and consumers.
I have one producer that produces data very fast and it takes data with a specific period from an external server. I have three consumers which need that data. The consumers do some processing on this data, so consumers are slower than the producer.
I use a queue to pass data and after a specific size I am blocking the producer and consumers with mutexes and conditional variables. But when the conditional_variable waits, the data that came from the server will be updated and when I wait I miss some data. How can this be avoided?