]> sigrok.org Git - pulseview.git/commitdiff
Don't join with non-threads. Fixes 323
authorMarcus Comstedt <redacted>
Sat, 22 Feb 2014 11:15:54 +0000 (12:15 +0100)
committerJoel Holdsworth <redacted>
Sat, 1 Mar 2014 11:02:10 +0000 (11:02 +0000)
pv/data/decoderstack.cpp
pv/sigsession.cpp
pv/storesession.cpp

index 9b02f9e929cc41b9ca75709acc27f3793745c333..9707d8d2cb605ddf61361bd48c648c4b48d65714 100644 (file)
@@ -67,8 +67,10 @@ DecoderStack::DecoderStack(const srd_decoder *const dec) :
 
 DecoderStack::~DecoderStack()
 {
-       _decode_thread.interrupt();
-       _decode_thread.join();
+       if (_decode_thread.joinable()) {
+               _decode_thread.interrupt();
+               _decode_thread.join();
+       }
 }
 
 const std::list< boost::shared_ptr<decode::Decoder> >&
@@ -168,8 +170,10 @@ void DecoderStack::begin_decode()
        shared_ptr<pv::view::LogicSignal> logic_signal;
        shared_ptr<pv::data::Logic> data;
 
-       _decode_thread.interrupt();
-       _decode_thread.join();
+       if (_decode_thread.joinable()) {
+               _decode_thread.interrupt();
+               _decode_thread.join();
+       }
 
        clear();
 
index 10ea4ffbea6dc1ad4e171b9054289e938fad66f0..b5387877dda0a73a513f7cb5f066e030f3b17539 100644 (file)
@@ -75,7 +75,8 @@ SigSession::~SigSession()
 {
        stop_capture();
 
-       _sampling_thread.join();
+       if (_sampling_thread.joinable())
+               _sampling_thread.join();
 
        if (_dev_inst)
                _device_manager.release_device(_dev_inst);
@@ -200,7 +201,8 @@ void SigSession::stop_capture()
        sr_session_stop();
 
        // Check that sampling stopped
-       _sampling_thread.join();
+       if (_sampling_thread.joinable())
+               _sampling_thread.join();
 }
 
 set< shared_ptr<data::SignalData> > SigSession::get_data() const
index ebb4b0ed374349e657fff6e14373c244afa23310..3d0f12fe7cb66b79027125bbc4a3363fdbeadc91 100644 (file)
@@ -135,7 +135,8 @@ bool StoreSession::start()
 
 void StoreSession::wait()
 {
-       _thread.join();
+       if (_thread.joinable())
+               _thread.join();
 }
 
 void StoreSession::cancel()