]> sigrok.org Git - pulseview.git/commitdiff
DecodeSignal: Remove global SRD mutex
authorSoeren Apel <redacted>
Sat, 1 Jul 2017 21:48:13 +0000 (23:48 +0200)
committerUwe Hermann <redacted>
Wed, 5 Jul 2017 22:37:08 +0000 (00:37 +0200)
libsigrokdecode commit 514b2edc54efda9c6698456748c4256bb901eddd
makes it thread-safe, so PV can now access it whenever it wants,
not needing to care about concurrent access.

pv/data/decodesignal.cpp
pv/data/decodesignal.hpp

index b1f3cea75a9d8d40a629df8d2f67ddb824cf2c0d..6ac66a1ab2af6cbd9e25e5e5f1bac00bf98f2389 100644 (file)
@@ -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<mutex> srd_lock(global_srd_mutex_);
-
-                       {
-                               lock_guard<mutex> input_lock(input_mutex_);
-                               sample_count = segment_->get_sample_count() - abs_start_samplenum;
-                       }
+                       lock_guard<mutex> input_lock(input_mutex_);
+                       sample_count = segment_->get_sample_count() - abs_start_samplenum;
 
                        if (sample_count > 0) {
                                decode_data(abs_start_samplenum, sample_count);
index d859ea0cdb665a9979d26685f639dbebca578333..d50aace9c2dc841fe62c5b820dcd9aa8a4bd22e0 100644 (file)
@@ -180,14 +180,6 @@ private:
        map<const decode::Row, decode::RowData> rows_;
        map<pair<const srd_decoder*, int>, 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_;