]> sigrok.org Git - pulseview.git/commitdiff
Session: Converted data_mutex_ into a std::recursive_mutex
authorJoel Holdsworth <redacted>
Fri, 17 Apr 2015 17:08:39 +0000 (18:08 +0100)
committerUwe Hermann <redacted>
Thu, 11 Jun 2015 18:38:47 +0000 (20:38 +0200)
pv/session.cpp
pv/session.hpp

index dd78f4a176088ebb69cc5089558b4d310a7d4415..e187a4d35245aecefe25b344433346595664c1f4 100644 (file)
@@ -60,6 +60,7 @@ using std::lock_guard;
 using std::list;
 using std::map;
 using std::mutex;
+using std::recursive_mutex;
 using std::set;
 using std::shared_ptr;
 using std::string;
@@ -322,7 +323,7 @@ void Session::update_signals()
 
        // Create data containers for the logic data segments
        {
-               lock_guard<mutex> data_lock(data_mutex_);
+               lock_guard<recursive_mutex> data_lock(data_mutex_);
 
                if (logic_channel_count == 0) {
                        logic_data_.reset();
@@ -480,7 +481,7 @@ void Session::feed_in_frame_begin()
 
 void Session::feed_in_logic(shared_ptr<Logic> logic)
 {
-       lock_guard<mutex> lock(data_mutex_);
+       lock_guard<recursive_mutex> lock(data_mutex_);
 
        if (!logic_data_)
        {
@@ -530,7 +531,7 @@ void Session::feed_in_logic(shared_ptr<Logic> logic)
 
 void Session::feed_in_analog(shared_ptr<Analog> analog)
 {
-       lock_guard<mutex> lock(data_mutex_);
+       lock_guard<recursive_mutex> lock(data_mutex_);
 
        const vector<shared_ptr<Channel>> channels = analog->channels();
        const unsigned int channel_count = channels.size();
@@ -634,7 +635,7 @@ void Session::data_feed_in(shared_ptr<sigrok::Device> device,
        case SR_DF_END:
        {
                {
-                       lock_guard<mutex> lock(data_mutex_);
+                       lock_guard<recursive_mutex> lock(data_mutex_);
                        cur_logic_segment_.reset();
                        cur_analog_segments_.clear();
                }
index f0b4c1624b88d29a249c011e38e8f063651f2744..90dd82374675d768dd1d68a3c94e2ba5cc9e276e 100644 (file)
@@ -167,7 +167,7 @@ private:
        mutable boost::shared_mutex signals_mutex_;
        std::unordered_set< std::shared_ptr<view::Signal> > signals_;
 
-       mutable std::mutex data_mutex_;
+       mutable std::recursive_mutex data_mutex_;
        std::shared_ptr<data::Logic> logic_data_;
        uint64_t cur_samplerate_;
        std::shared_ptr<data::LogicSegment> cur_logic_segment_;