]> sigrok.org Git - pulseview.git/commitdiff
Session: don't hold sampling_mutex_ during signal emission.
authorTilman Sauerbeck <redacted>
Mon, 9 Nov 2015 06:28:59 +0000 (07:28 +0100)
committerTilman Sauerbeck <redacted>
Mon, 9 Nov 2015 17:26:55 +0000 (18:26 +0100)
We were holding the lock while emitting capture_state_changed.

pv/session.cpp

index da9c0e9bb4af998abf3a3303eb525536245b3ba9..2a794f0fb0c4af8a79b662e12b810ffdb28b510d 100644 (file)
@@ -324,9 +324,14 @@ void Session::remove_decode_signal(view::DecodeTrace *signal)
 
 void Session::set_capture_state(capture_state state)
 {
-       lock_guard<mutex> lock(sampling_mutex_);
-       const bool changed = capture_state_ != state;
-       capture_state_ = state;
+       bool changed;
+
+       {
+               lock_guard<mutex> lock(sampling_mutex_);
+               changed = capture_state_ != state;
+               capture_state_ = state;
+       }
+
        if (changed)
                capture_state_changed(state);
 }