TH_CLEAN_3.5: push() cleanup side of things, assure SDRThread::readStream() to actually check for full + make ThreadQueue notify even in case on not-successfull push(), make it spam notify_all() everytime

This commit is contained in:
vsonnier
2016-07-06 21:23:59 +02:00
parent b495b388c9
commit 21c8a81c32
13 changed files with 197 additions and 99 deletions
+8 -4
View File
@@ -68,11 +68,13 @@ public:
bool push(const value_type& item) {
std::lock_guard < std::mutex > lock(m_mutex);
if (m_max_num_items.load() > 0 && m_queue.size() > m_max_num_items.load())
if (m_max_num_items.load() > 0 && m_queue.size() > m_max_num_items.load()) {
m_condition.notify_all();
return false;
}
m_queue.push(item);
m_condition.notify_one();
m_condition.notify_all();
return true;
}
@@ -84,11 +86,13 @@ public:
bool push(const value_type&& item) {
std::lock_guard < std::mutex > lock(m_mutex);
if (m_max_num_items.load() > 0 && m_queue.size() > m_max_num_items.load())
if (m_max_num_items.load() > 0 && m_queue.size() > m_max_num_items.load()) {
m_condition.notify_all();
return false;
}
m_queue.push(item);
m_condition.notify_one();
m_condition.notify_all();
return true;
}