summaryrefslogtreecommitdiff
path: root/libs/binder/RpcServer.cpp
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2021-05-20 00:07:41 +0000
committer Steven Moreland <smoreland@google.com> 2021-05-20 00:07:41 +0000
commite47511f808818fca08962fa268700ca3d31224a3 (patch)
tree5153a7f64ebfa2d2c7ff246baaf1e2c5095e6757 /libs/binder/RpcServer.cpp
parent33fd596d5449bb9fb1dfc9bbaf53fdee1b129ba4 (diff)
libbinder: move FdTrigger to RpcSession
We need triggers accessible in RpcSession, RpcServer, and RpcState in order to shut down the join + connection + rpc handler threads (the RpcServer connection threads get transformed into becoming RpcSession threads). In order for this to be used in all these places, the most convenient location is RpcSession, since the RpcServer header imports this and the C++ standard doesn't allow for nested classes to be forward declared. Bug: 185167543 Test: binderRpcTest Change-Id: I3e655277bd183fddc6d5001280cf17a10672bea3
Diffstat (limited to 'libs/binder/RpcServer.cpp')
-rw-r--r--libs/binder/RpcServer.cpp12
1 files changed, 1 insertions, 11 deletions
diff --git a/libs/binder/RpcServer.cpp b/libs/binder/RpcServer.cpp
index e31aea021f..df7c844bc8 100644
--- a/libs/binder/RpcServer.cpp
+++ b/libs/binder/RpcServer.cpp
@@ -128,16 +128,6 @@ sp<IBinder> RpcServer::getRootObject() {
return ret;
}
-std::unique_ptr<RpcServer::FdTrigger> RpcServer::FdTrigger::make() {
- auto ret = std::make_unique<RpcServer::FdTrigger>();
- if (!android::base::Pipe(&ret->mRead, &ret->mWrite)) return nullptr;
- return ret;
-}
-
-void RpcServer::FdTrigger::trigger() {
- mWrite.reset();
-}
-
void RpcServer::join() {
LOG_ALWAYS_FATAL_IF(!mAgreedExperimental, "no!");
@@ -146,7 +136,7 @@ void RpcServer::join() {
LOG_ALWAYS_FATAL_IF(!mServer.ok(), "RpcServer must be setup to join.");
LOG_ALWAYS_FATAL_IF(mShutdownTrigger != nullptr, "Already joined");
mJoinThreadRunning = true;
- mShutdownTrigger = FdTrigger::make();
+ mShutdownTrigger = RpcSession::FdTrigger::make();
LOG_ALWAYS_FATAL_IF(mShutdownTrigger == nullptr, "Cannot create join signaler");
}