From 25f7ba386d23de4923a7f69a6047f5cc2b8adfb7 Mon Sep 17 00:00:00 2001 From: vsonnier Date: Sun, 12 Feb 2017 16:48:04 +0100 Subject: [PATCH] BLOCKING_QUEUE: remove ThreadBlockingQueue dependency to ThreadQueue, remove ThreadQueue.h from CMakeLists --- CMakeLists.txt | 1 - src/IOThread.h | 2 +- src/audio/AudioThread.h | 1 - src/util/ThreadBlockingQueue.h | 9 ++++++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee0d4d8..2a0906c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -441,7 +441,6 @@ SET (cubicsdr_headers src/audio/AudioThread.h src/util/Gradient.h src/util/Timer.h - src/util/ThreadQueue.h src/util/ThreadBlockingQueue.h src/util/MouseTracker.h src/util/GLExt.h diff --git a/src/IOThread.h b/src/IOThread.h index 9750366..46ce897 100644 --- a/src/IOThread.h +++ b/src/IOThread.h @@ -12,7 +12,7 @@ #include #include -#include "ThreadQueue.h" +#include "ThreadBlockingQueue.h" #include "Timer.h" struct map_string_less : public std::binary_function diff --git a/src/audio/AudioThread.h b/src/audio/AudioThread.h index f472725..ce349c0 100644 --- a/src/audio/AudioThread.h +++ b/src/audio/AudioThread.h @@ -9,7 +9,6 @@ #include #include -#include "AudioThread.h" #include "ThreadBlockingQueue.h" #include "RtAudio.h" #include "DemodDefs.h" diff --git a/src/util/ThreadBlockingQueue.h b/src/util/ThreadBlockingQueue.h index 10fad27..ab95d93 100644 --- a/src/util/ThreadBlockingQueue.h +++ b/src/util/ThreadBlockingQueue.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include #define MIN_ITEM_NB (1) @@ -21,6 +21,9 @@ //an indefnite timeout duration. #define BLOCKING_INFINITE_TIMEOUT (0) +class ThreadQueueBase { +}; + /** A thread-safe asynchronous blocking queue */ template class ThreadBlockingQueue : public ThreadQueueBase { @@ -29,7 +32,6 @@ class ThreadBlockingQueue : public ThreadQueueBase { typedef typename std::deque::size_type size_type; public: - /*! Create safe blocking queue. */ ThreadBlockingQueue() { @@ -37,6 +39,7 @@ public: m_max_num_items = MIN_ITEM_NB; }; + //Copy constructor ThreadBlockingQueue(const ThreadBlockingQueue& sq) { std::lock_guard < std::mutex > lock(sq.m_mutex); m_queue = sq.m_queue; @@ -57,7 +60,7 @@ public: std::lock_guard < std::mutex > lock(m_mutex); if (max_num_items > m_max_num_items) { - //Only raise the existing max size, never squash it + //Only raise the existing max size, never reduce it //for simplification sake at runtime. m_max_num_items = max_num_items; m_cond_not_full.notify_all();