mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-02 14:04:47 -04:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user