aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2016-09-21 19:05:02 -0500
committerCharles Kerr <charles.kerr@canonical.com>2016-09-21 19:05:02 -0500
commit3b7185fdf0d21897fd874d337d57379f911cc63c (patch)
tree597211ef20d1a5b77c1c226150f07797137d0697
parent996f5b96f12e77e922114734ed8524ce7d5f62bc (diff)
downloadayatana-indicator-display-3b7185fdf0d21897fd874d337d57379f911cc63c.tar.gz
ayatana-indicator-display-3b7185fdf0d21897fd874d337d57379f911cc63c.tar.bz2
ayatana-indicator-display-3b7185fdf0d21897fd874d337d57379f911cc63c.zip
in adbd-client's dtor, check the worker thread's joinable() state before calling join() on it
-rw-r--r--src/adbd-client.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/adbd-client.cpp b/src/adbd-client.cpp
index e436a43..85389f4 100644
--- a/src/adbd-client.cpp
+++ b/src/adbd-client.cpp
@@ -48,7 +48,8 @@ public:
g_cancellable_cancel(m_cancellable);
m_pkresponse_cv.notify_one();
m_sleep_cv.notify_one();
- m_worker_thread.join();
+ if (m_worker_thread.joinable())
+ m_worker_thread.join();
g_clear_object(&m_cancellable);
}
@@ -104,6 +105,8 @@ private:
void on_public_key_response(PKResponse response)
{
+ g_debug("%s got response %d", G_STRLOC, int(response));
+
// set m_pkresponse and wake up the waiting worker thread
std::unique_lock<std::mutex> lk(m_pkresponse_mutex);
m_pkresponse = response;
@@ -141,11 +144,13 @@ private:
std::unique_lock<std::mutex> lk(m_pkresponse_mutex);
m_pkresponse_ready = false;
pass_public_key_to_main_thread(public_key);
+ g_debug("%s thread %p waiting", G_STRLOC, g_thread_self());
m_pkresponse_cv.wait(lk, [this](){
return m_pkresponse_ready || g_cancellable_is_cancelled(m_cancellable);
});
response = m_pkresponse;
- g_debug("%s got response '%d', is-cancelled %d", G_STRLOC,
+ g_debug("%s thread %p got response '%d', is-cancelled %d", G_STRLOC,
+ g_thread_self(),
int(response),
int(g_cancellable_is_cancelled(m_cancellable)));
}