summaryrefslogtreecommitdiffstats
path: root/src/Log.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-04-20 12:29:24 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-04-20 12:29:24 +0200
commit411d03ac6b8ee1a8c06f952b9378c90516a715b7 (patch)
tree3236a6121eb9137a79b82699006df877e3876c32 /src/Log.cpp
parent4f9b087a578fac9dffef83cdcb41573468a4ae17 (diff)
downloaddabmod-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/Log.cpp')
-rw-r--r--src/Log.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Log.cpp b/src/Log.cpp
index ee16880..81f7955 100644
--- a/src/Log.cpp
+++ b/src/Log.cpp
@@ -82,15 +82,15 @@ void Logger::io_process()
set_thread_name("logger");
while (1) {
log_message_t m;
- m_message_queue.wait_and_pop(m);
-
- auto message = m.message;
-
- if (m.level == trace and m.message.empty()) {
- // Special message to stop thread
+ try {
+ m_message_queue.wait_and_pop(m);
+ }
+ catch (const ThreadsafeQueueWakeup&) {
break;
}
+ auto message = m.message;
+
/* Remove a potential trailing newline.
* It doesn't look good in syslog
*/