BLOCKING_QUEUE: remove ThreadBlockingQueue dependency to ThreadQueue, remove ThreadQueue.h from CMakeLists

This commit is contained in:
vsonnier 2017-02-12 16:48:04 +01:00
parent c7467a88bc
commit 25f7ba386d
4 changed files with 7 additions and 6 deletions

View File

@ -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

View File

@ -12,7 +12,7 @@
#include <iostream>
#include <thread>
#include "ThreadQueue.h"
#include "ThreadBlockingQueue.h"
#include "Timer.h"
struct map_string_less : public std::binary_function<std::string,std::string,bool>

View File

@ -9,7 +9,6 @@
#include <string>
#include <atomic>
#include "AudioThread.h"
#include "ThreadBlockingQueue.h"
#include "RtAudio.h"
#include "DemodDefs.h"

View File

@ -9,7 +9,7 @@
#include <cstdint>
#include <stddef.h>
#include <condition_variable>
#include <ThreadQueue.h>
#include <typeinfo>
#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<typename T>
class ThreadBlockingQueue : public ThreadQueueBase {
@ -29,7 +32,6 @@ class ThreadBlockingQueue : public ThreadQueueBase {
typedef typename std::deque<T>::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();