summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/binder/RpcServer.cpp12
-rw-r--r--libs/binder/RpcSession.cpp10
-rw-r--r--libs/binder/include/binder/RpcServer.h19
-rw-r--r--libs/binder/include/binder/RpcSession.h17
4 files changed, 29 insertions, 29 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");
}
diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp
index 05fa49ec76..4efa6bb1a9 100644
--- a/libs/binder/RpcSession.cpp
+++ b/libs/binder/RpcSession.cpp
@@ -113,6 +113,16 @@ status_t RpcSession::sendDecStrong(const RpcAddress& address) {
return state()->sendDecStrong(connection.fd(), address);
}
+std::unique_ptr<RpcSession::FdTrigger> RpcSession::FdTrigger::make() {
+ auto ret = std::make_unique<RpcSession::FdTrigger>();
+ if (!android::base::Pipe(&ret->mRead, &ret->mWrite)) return nullptr;
+ return ret;
+}
+
+void RpcSession::FdTrigger::trigger() {
+ mWrite.reset();
+}
+
status_t RpcSession::readId() {
{
std::lock_guard<std::mutex> _l(mMutex);
diff --git a/libs/binder/include/binder/RpcServer.h b/libs/binder/include/binder/RpcServer.h
index 49734007ac..d1a86277f3 100644
--- a/libs/binder/include/binder/RpcServer.h
+++ b/libs/binder/include/binder/RpcServer.h
@@ -153,23 +153,6 @@ public:
void onSessionTerminating(const sp<RpcSession>& session);
private:
- /** This is not a pipe. */
- struct FdTrigger {
- static std::unique_ptr<FdTrigger> make();
- /**
- * poll() on this fd for POLLHUP to get notification when trigger is called
- */
- base::borrowed_fd readFd() const { return mRead; }
- /**
- * Close the write end of the pipe so that the read end receives POLLHUP.
- */
- void trigger();
-
- private:
- base::unique_fd mWrite;
- base::unique_fd mRead;
- };
-
friend sp<RpcServer>;
RpcServer();
@@ -188,7 +171,7 @@ private:
std::map<int32_t, sp<RpcSession>> mSessions;
int32_t mSessionIdCounter = 0;
bool mJoinThreadRunning = false;
- std::unique_ptr<FdTrigger> mShutdownTrigger;
+ std::unique_ptr<RpcSession::FdTrigger> mShutdownTrigger;
std::condition_variable mShutdownCv;
};
diff --git a/libs/binder/include/binder/RpcSession.h b/libs/binder/include/binder/RpcSession.h
index bcc213c8bd..6a60e7e999 100644
--- a/libs/binder/include/binder/RpcSession.h
+++ b/libs/binder/include/binder/RpcSession.h
@@ -112,6 +112,23 @@ private:
friend RpcServer;
RpcSession();
+ /** This is not a pipe. */
+ struct FdTrigger {
+ static std::unique_ptr<FdTrigger> make();
+ /**
+ * poll() on this fd for POLLHUP to get notification when trigger is called
+ */
+ base::borrowed_fd readFd() const { return mRead; }
+ /**
+ * Close the write end of the pipe so that the read end receives POLLHUP.
+ */
+ void trigger();
+
+ private:
+ base::unique_fd mWrite;
+ base::unique_fd mRead;
+ };
+
status_t readId();
// transfer ownership of thread