mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-09-06 07:07:48 -04:00
BLOCKING_QUEUE: remove ThreadBlockingQueue dependency to ThreadQueue, remove ThreadQueue.h from CMakeLists
This commit is contained in:
parent
c7467a88bc
commit
25f7ba386d
@ -441,7 +441,6 @@ SET (cubicsdr_headers
|
|||||||
src/audio/AudioThread.h
|
src/audio/AudioThread.h
|
||||||
src/util/Gradient.h
|
src/util/Gradient.h
|
||||||
src/util/Timer.h
|
src/util/Timer.h
|
||||||
src/util/ThreadQueue.h
|
|
||||||
src/util/ThreadBlockingQueue.h
|
src/util/ThreadBlockingQueue.h
|
||||||
src/util/MouseTracker.h
|
src/util/MouseTracker.h
|
||||||
src/util/GLExt.h
|
src/util/GLExt.h
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include "ThreadQueue.h"
|
#include "ThreadBlockingQueue.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
|
||||||
struct map_string_less : public std::binary_function<std::string,std::string,bool>
|
struct map_string_less : public std::binary_function<std::string,std::string,bool>
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
#include "AudioThread.h"
|
|
||||||
#include "ThreadBlockingQueue.h"
|
#include "ThreadBlockingQueue.h"
|
||||||
#include "RtAudio.h"
|
#include "RtAudio.h"
|
||||||
#include "DemodDefs.h"
|
#include "DemodDefs.h"
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <ThreadQueue.h>
|
#include <typeinfo>
|
||||||
|
|
||||||
#define MIN_ITEM_NB (1)
|
#define MIN_ITEM_NB (1)
|
||||||
|
|
||||||
@ -21,6 +21,9 @@
|
|||||||
//an indefnite timeout duration.
|
//an indefnite timeout duration.
|
||||||
#define BLOCKING_INFINITE_TIMEOUT (0)
|
#define BLOCKING_INFINITE_TIMEOUT (0)
|
||||||
|
|
||||||
|
class ThreadQueueBase {
|
||||||
|
};
|
||||||
|
|
||||||
/** A thread-safe asynchronous blocking queue */
|
/** A thread-safe asynchronous blocking queue */
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class ThreadBlockingQueue : public ThreadQueueBase {
|
class ThreadBlockingQueue : public ThreadQueueBase {
|
||||||
@ -29,7 +32,6 @@ class ThreadBlockingQueue : public ThreadQueueBase {
|
|||||||
typedef typename std::deque<T>::size_type size_type;
|
typedef typename std::deque<T>::size_type size_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
/*! Create safe blocking queue. */
|
/*! Create safe blocking queue. */
|
||||||
ThreadBlockingQueue() {
|
ThreadBlockingQueue() {
|
||||||
@ -37,6 +39,7 @@ public:
|
|||||||
m_max_num_items = MIN_ITEM_NB;
|
m_max_num_items = MIN_ITEM_NB;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//Copy constructor
|
||||||
ThreadBlockingQueue(const ThreadBlockingQueue& sq) {
|
ThreadBlockingQueue(const ThreadBlockingQueue& sq) {
|
||||||
std::lock_guard < std::mutex > lock(sq.m_mutex);
|
std::lock_guard < std::mutex > lock(sq.m_mutex);
|
||||||
m_queue = sq.m_queue;
|
m_queue = sq.m_queue;
|
||||||
@ -57,7 +60,7 @@ public:
|
|||||||
std::lock_guard < std::mutex > lock(m_mutex);
|
std::lock_guard < std::mutex > lock(m_mutex);
|
||||||
|
|
||||||
if (max_num_items > m_max_num_items) {
|
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.
|
//for simplification sake at runtime.
|
||||||
m_max_num_items = max_num_items;
|
m_max_num_items = max_num_items;
|
||||||
m_cond_not_full.notify_all();
|
m_cond_not_full.notify_all();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user