Move code out of frame, proper thread termination

This commit is contained in:
Charles J. Cliffe
2014-11-23 19:39:27 -05:00
parent ac20bc1e84
commit cae1855fc5
15 changed files with 171 additions and 196 deletions
+5 -2
View File
@@ -4,7 +4,7 @@
#include "CubicSDR.h"
SDRThread::SDRThread(SDRThreadCommandQueue* pQueue) :
m_pQueue(pQueue), iqDataOutQueue(NULL), iqVisualQueue(NULL) {
m_pQueue(pQueue), iqDataOutQueue(NULL), iqVisualQueue(NULL), terminated(false) {
dev = NULL;
sample_rate = SRATE;
}
@@ -121,7 +121,7 @@ void SDRThread::threadMain() {
double seconds = 0.0;
std::cout << "Sampling..";
while (1) {
while (!terminated) {
if (!m_pQueue->empty()) {
bool freq_changed = false;
float new_freq;
@@ -186,3 +186,6 @@ void SDRThread::threadMain() {
}
void SDRThread::terminate() {
terminated = true;
}