From baa9f937ac60cf1077a0f65197478a376135134d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 22 Sep 2016 12:03:49 -0500 Subject: GAdbdClient::Impl::on_public_key_response() doesn't need a condition variable wait, so use std::lock_guard rather than std::unique_lock --- src/adbd-client.cpp | 13 +++++++------ src/main.cpp | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/adbd-client.cpp b/src/adbd-client.cpp index 1539982..0d955ab 100644 --- a/src/adbd-client.cpp +++ b/src/adbd-client.cpp @@ -44,7 +44,7 @@ g_debug("%s %s", G_STRLOC, G_STRFUNC); ~Impl() { -g_debug("%s %s", G_STRLOC, G_STRFUNC); +g_debug("%s %s DTOR DTOR dtor", G_STRLOC, G_STRFUNC); // tell the worker thread to stop whatever it's doing and exit. g_debug("%s Client::Impl dtor, cancelling m_cancellable", G_STRLOC); g_debug("%s %s", G_STRLOC, G_STRFUNC); @@ -63,7 +63,7 @@ g_debug("%s %s", G_STRLOC, G_STRFUNC); core::Signal& on_pk_request() { -g_debug("%s %s", G_STRLOC, G_STRFUNC); +g_debug("%s %s thread %p", G_STRLOC, G_STRFUNC, g_thread_self()); return m_on_pk_request; } @@ -98,7 +98,7 @@ g_debug("%s %s", G_STRLOC, G_STRFUNC); { /* NB: It's possible (though unlikely) that data.self was destroyed while this callback was pending, so we must check is-cancelled FIRST */ -g_debug("%s %s", G_STRLOC, G_STRFUNC); +g_debug("%s %s thread is %p", G_STRLOC, G_STRFUNC, g_thread_self()); auto data = static_cast(gdata); g_debug("%s %s", G_STRLOC, G_STRFUNC); if (!g_cancellable_is_cancelled(data->cancellable)) @@ -127,11 +127,12 @@ g_debug("%s %s", G_STRLOC, G_STRFUNC); void on_public_key_response(PKResponse response) { g_debug("%s %s", G_STRLOC, G_STRFUNC); - g_debug("%s got response %d", G_STRLOC, int(response)); + g_debug("%s thread %p got response %d", G_STRLOC, g_thread_self(), int(response)); g_debug("%s %s", G_STRLOC, G_STRFUNC); // set m_pkresponse and wake up the waiting worker thread - std::unique_lock lk(m_pkresponse_mutex); + std::lock_guard lk(m_sleep_mutex); + //std::unique_lock lk(m_pkresponse_mutex); g_debug("%s %s", G_STRLOC, G_STRFUNC); m_pkresponse = response; g_debug("%s %s", G_STRLOC, G_STRFUNC); @@ -147,7 +148,7 @@ g_debug("%s %s", G_STRLOC, G_STRFUNC); void worker_func() // runs in worker thread { -g_debug("%s %s", G_STRLOC, G_STRFUNC); +g_debug("%s %s worker thread is %p", G_STRLOC, G_STRFUNC, g_thread_self()); const std::string socket_path {m_socket_path}; g_debug("%s %s", G_STRLOC, G_STRFUNC); diff --git a/src/main.cpp b/src/main.cpp index 52cdd58..43dc5f5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,6 +46,7 @@ main(int /*argc*/, char** /*argv*/) g_warning("busname lost: '%s'", name.c_str()); g_main_loop_quit(loop); }; +g_debug("%s %s main thread is %p", G_STRLOC, G_STRFUNC, g_thread_self()); // build all our indicators. // Right now we've only got one -- rotation lock -- but hey, we can dream. -- cgit v1.2.3