From: Joel Holdsworth Date: Thu, 29 May 2014 22:22:52 +0000 (+0100) Subject: SigSession: Fixed std::thread joining X-Git-Tag: pulseview-0.3.0~597 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=04463625a6df63c87e445e9950260d4ecc95a79e;p=pulseview.git SigSession: Fixed std::thread joining --- diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index 87b561eb..e42ba2cb 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -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 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())