Transport threadpool configuration.

Servers can specify the number of threads they'd like to
have for handling incoming RPC calls, as well as whether
they'd like to join the threadpool themselves, by calling:

configureRpcThreadpool(numThreads, true /* callerWillJoin */);

This method *must* be called before interacting with any
HIDL services, including the servicemanager through
IFoo::getService / IFoo.registerAsService().

If the server indicated it wanted to join, it should do so
as soon as it can with:

joinRpcThreadpool();

This allows a server full flexibility:
- Without any of these calls, a threadpool of size 1 will be
  started, and the main thread won't be a part of it.
- If the server wants a single-threaded RPC pool with its own
  main thread for handling incoming RPC transactions, it can call
  configureRpcThreadpool(1, true) followed by joinRpcThreadpool().
- If the server wants a multi-threaded RPC pool, it can call
  configureRpcThreadpool(5, join) followed by joinRpcThreadpool()
  if join was set to true.

Bug: 31226656
Test: mma, hidl_test
Change-Id: I9a3c68ebbe34ea9f14cdae48ca9908d05012c3f2
4 files changed