Avoid poping queue if empty

master
Xavier Arteaga 3 years ago committed by Xavier Arteaga
parent e6af64c147
commit a9591f1d45

@ -75,8 +75,10 @@ public:
{
std::unique_lock<std::mutex> lock(mutex);
// Pop first element
fifo.pop_front();
// If the FIFO is not empty pop first element
if (not fifo.empty()) {
fifo.pop_front();
}
// Notify release
cvar.notify_all();

Loading…
Cancel
Save