diff --git a/src/Proxy.cpp b/src/Proxy.cpp index d9a2ea3..ea3f51a 100644 --- a/src/Proxy.cpp +++ b/src/Proxy.cpp @@ -149,13 +149,13 @@ MethodReply Proxy::callMethodWithAsyncReplyBlocking(const MethodCall& message, u // VARIANT 3: USING CLASSIC ASYNC APPROACH // TODO: Try with thread local std::function -// thread_local async_reply_handler asyncReplyCallback = [](MethodReply& reply, const Error* error) -// { -// auto& syncCallReplyData = getSyncCallReplyData(); +// /*thread_local*/ SyncCallReplyData syncCallReplyData; +// async_reply_handler asyncReplyCallback = [&syncCallReplyData](MethodReply& reply, const Error* error) +// { // std::unique_lock lock(syncCallReplyData.mutex); -// syncCallReplyData.error = nullptr; +// //syncCallReplyData.error = nullptr; // if (error == nullptr) // syncCallReplyData.reply = std::move(reply); // else @@ -166,14 +166,13 @@ MethodReply Proxy::callMethodWithAsyncReplyBlocking(const MethodCall& message, u // syncCallReplyData.cond.notify_one(); // }; -// AsyncCalls::CallData callData{*this, /*std::move(*/asyncReplyCallback/*)*/, {}}; +// AsyncCalls::CallData callData{*this, std::move(asyncReplyCallback), {}}; // message.sendWithAsyncReply((void*)&Proxy::sdbus_async_reply_handler, &callData, timeout); -// auto& syncCallReplyData = getSyncCallReplyData(); // std::unique_lock lock(syncCallReplyData.mutex); // syncCallReplyData.cond.wait(lock, [&syncCallReplyData](){ return syncCallReplyData.arrived; }); -// syncCallReplyData.arrived = false; +// //syncCallReplyData.arrived = false; // if (syncCallReplyData.error) // throw *syncCallReplyData.error; diff --git a/src/Proxy.h b/src/Proxy.h index 7f87db7..4740a61 100644 --- a/src/Proxy.h +++ b/src/Proxy.h @@ -140,7 +140,7 @@ namespace internal { { std::mutex mutex; std::condition_variable cond; - bool arrived; + bool arrived{}; MethodReply reply; std::unique_ptr error; };