Merge "libbinder: RPC save notify on transferring thread" am: 385b661266 am: f8c5ab9196
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1716635
Change-Id: I339693ce79b270337b97a262ffd0d34da8f59028
diff --git a/libs/binder/RpcServer.cpp b/libs/binder/RpcServer.cpp
index 93f9709..d8ba2c6 100644
--- a/libs/binder/RpcServer.cpp
+++ b/libs/binder/RpcServer.cpp
@@ -258,18 +258,12 @@
LOG_ALWAYS_FATAL_IF(threadId == server->mConnectingThreads.end(),
"Must establish connection on owned thread");
thisThread = std::move(threadId->second);
- ScopeGuard detachGuard = [&]() { thisThread.detach(); };
- server->mConnectingThreads.erase(threadId);
-
- // TODO(b/185167543): we currently can't disable this because we don't
- // shutdown sessions as well, only the server itself. So, we need to
- // keep this separate from the detachGuard, since we temporarily want to
- // give a notification even when we pass ownership of the thread to
- // a session.
- ScopeGuard threadLifetimeGuard = [&]() {
+ ScopeGuard detachGuard = [&]() {
+ thisThread.detach();
_l.unlock();
server->mShutdownCv.notify_all();
};
+ server->mConnectingThreads.erase(threadId);
if (!idValid) {
return;