]> sigrok.org Git - pulseview.git/commitdiff
SigSession: Fixed std::thread joining
authorJoel Holdsworth <redacted>
Thu, 29 May 2014 22:22:52 +0000 (23:22 +0100)
committerJoel Holdsworth <redacted>
Thu, 5 Jun 2014 19:49:19 +0000 (20:49 +0100)
pv/sigsession.cpp

index 87b561eb11ccc8a09aea5db2b1f2f652810a5344..e42ba2cbdc3f997d73f67e0b855f6affb4f55e0b 100644 (file)
@@ -77,11 +77,9 @@ SigSession::~SigSession()
 {
        using pv::device::Device;
 
+       // Stop and join to the thread
        stop_capture();
 
-       if (_sampling_thread.joinable())
-               _sampling_thread.join();
-
        _dev_inst->release();
 
        // TODO: This should not be necessary
@@ -195,10 +193,8 @@ void SigSession::start_capture(function<void (const QString)> error_handler)
 
 void SigSession::stop_capture()
 {
-       if (get_capture_state() == Stopped)
-               return;
-
-       sr_session_stop();
+       if (get_capture_state() != Stopped)
+               sr_session_stop();
 
        // Check that sampling stopped
        if (_sampling_thread.joinable())