diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-04-20 12:29:24 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-04-20 12:29:24 +0200 |
commit | 411d03ac6b8ee1a8c06f952b9378c90516a715b7 (patch) | |
tree | 3236a6121eb9137a79b82699006df877e3876c32 /src/output | |
parent | 4f9b087a578fac9dffef83cdcb41573468a4ae17 (diff) | |
download | dabmod-411d03ac6b8ee1a8c06f952b9378c90516a715b7.tar.gz dabmod-411d03ac6b8ee1a8c06f952b9378c90516a715b7.tar.bz2 dabmod-411d03ac6b8ee1a8c06f952b9378c90516a715b7.zip |
ThreadsafeQueue: add wakeup event instead of custom termination markers
This avoids the issue that the ~SDR termination marker doesn't reach the
consumer because it's still prebuffering
Diffstat (limited to 'src/output')
-rw-r--r-- | src/output/SDR.cpp | 10 | ||||
-rw-r--r-- | src/output/Soapy.h | 1 | ||||
-rw-r--r-- | src/output/USRPTime.h | 1 |
3 files changed, 5 insertions, 7 deletions
diff --git a/src/output/SDR.cpp b/src/output/SDR.cpp index b47433d..7c1b585 100644 --- a/src/output/SDR.cpp +++ b/src/output/SDR.cpp @@ -84,9 +84,7 @@ SDR::~SDR() { m_running.store(false); - FrameData end_marker; - end_marker.buf.clear(); - m_queue.push(end_marker); + m_queue.trigger_wakeup(); if (m_device_thread.joinable()) { m_device_thread.join(); @@ -181,7 +179,7 @@ void SDR::process_thread_entry() m_queue.wait_and_pop(frame, pop_prebuffering); etiLog.log(trace, "SDR,pop"); - if (m_running.load() == false or frame.buf.empty()) { + if (m_running.load() == false) { break; } @@ -203,8 +201,10 @@ void SDR::process_thread_entry() } } } + catch (const ThreadsafeQueueWakeup& e) { } catch (const runtime_error& e) { - etiLog.level(error) << "SDR output thread caught runtime error: " << e.what(); + etiLog.level(error) << "SDR output thread caught runtime error: " << + e.what(); } m_running.store(false); diff --git a/src/output/Soapy.h b/src/output/Soapy.h index 5c20156..3045420 100644 --- a/src/output/Soapy.h +++ b/src/output/Soapy.h @@ -48,7 +48,6 @@ DESCRIPTION: #include "ModPlugin.h" #include "EtiReader.h" #include "RemoteControl.h" -#include "ThreadsafeQueue.h" namespace Output { diff --git a/src/output/USRPTime.h b/src/output/USRPTime.h index 70e55ae..51ca800 100644 --- a/src/output/USRPTime.h +++ b/src/output/USRPTime.h @@ -48,7 +48,6 @@ DESCRIPTION: #include "output/SDR.h" #include "TimestampDecoder.h" #include "RemoteControl.h" -#include "ThreadsafeQueue.h" #include <stdio.h> #include <sys/types.h> |