From: Soeren Apel Date: Sat, 1 Jul 2017 21:48:13 +0000 (+0200) Subject: DecodeSignal: Remove global SRD mutex X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=767bf4e705c4b977301a956cb8d0c777f7e8c8d4;p=pulseview.git DecodeSignal: Remove global SRD mutex libsigrokdecode commit 514b2edc54efda9c6698456748c4256bb901eddd makes it thread-safe, so PV can now access it whenever it wants, not needing to care about concurrent access. --- diff --git a/pv/data/decodesignal.cpp b/pv/data/decodesignal.cpp index b1f3cea7..6ac66a1a 100644 --- a/pv/data/decodesignal.cpp +++ b/pv/data/decodesignal.cpp @@ -49,8 +49,6 @@ const double DecodeSignal::DecodeMargin = 1.0; const double DecodeSignal::DecodeThreshold = 0.2; const int64_t DecodeSignal::DecodeChunkLength = 256 * 1024; -mutex DecodeSignal::global_srd_mutex_; - DecodeSignal::DecodeSignal(pv::Session &session) : SignalBase(nullptr, SignalBase::DecodeChannel), @@ -822,13 +820,8 @@ void DecodeSignal::decode_proc() do { // Keep processing new samples until we exhaust the input data do { - // Prevent any other decode threads from accessing libsigrokdecode - lock_guard srd_lock(global_srd_mutex_); - - { - lock_guard input_lock(input_mutex_); - sample_count = segment_->get_sample_count() - abs_start_samplenum; - } + lock_guard input_lock(input_mutex_); + sample_count = segment_->get_sample_count() - abs_start_samplenum; if (sample_count > 0) { decode_data(abs_start_samplenum, sample_count); diff --git a/pv/data/decodesignal.hpp b/pv/data/decodesignal.hpp index d859ea0c..d50aace9 100644 --- a/pv/data/decodesignal.hpp +++ b/pv/data/decodesignal.hpp @@ -180,14 +180,6 @@ private: map rows_; map, decode::Row> class_rows_; - /** - * This mutex prevents more than one thread from accessing - * libsigrokdecode concurrently. - * @todo A proper solution should be implemented to allow multiple - * decode operations in parallel. - */ - static mutex global_srd_mutex_; - mutable mutex input_mutex_, output_mutex_, logic_mux_mutex_; mutable condition_variable decode_input_cond_, logic_mux_cond_; bool frame_complete_;