Discard old chunks if not consumed (fixes #708)

This commit is contained in:
badaix 2020-10-11 11:11:49 +02:00
parent 8e9eb5c870
commit 136766412c
3 changed files with 30 additions and 5 deletions

View file

@ -103,8 +103,16 @@ public:
std::lock_guard<std::mutex> mlock(mutex_);
if (queue_.empty())
return false;
T t = queue_.back();
copy = t;
copy = queue_.back();
return true;
}
bool front_copy(T& copy)
{
std::lock_guard<std::mutex> mlock(mutex_);
if (queue_.empty())
return false;
copy = queue_.front();
return true;
}