~RpcServer() calls shutdown explicitly.

If a thread is calling RpcServer::join() and poll()-ing,
when ~RpcServer() is called, the first thing it does
is deleting mJoinShutdownTrigger, which will close the
read end first.

poll(2):
  For a discussion of what may happen if a file descriptor being
  monitored by poll() is closed in another thread, see select(2).

select(2):
  If a file descriptor being monitored by select() is closed in
  another thread, the result is unspecified.

To avoid relying on UB, properly shut down before closing these fds.

Test: binderRpcTest
Test: binderLibTest

Bug: 182914638

Change-Id: Id689fa31e6cbf055f6c60a443e8f4ad0dae7ceb1
1 file changed