There's a requirement that new RPCs can't be registered once the server has been shutdown nor can new RPC operations be initiated once the CQ has been shutdown. These are, imo, the two rough edges in the C++ CQ-based async API. The shutdown mutex protects against that possibility. Note that it's actually an array of mutexes: one per RPC-processing thread. So, in the common case, the mutex will be uncontended since the same thread keeps accessing it over and over again. Only at shutdown the master thread will take the locks on each of the worker threads and shut them down, after which they'll next see their shutdown state updated and will stop performing operations. Because it's uncontended in the common case, it's unlikely to cause any substantial positive performance impact if it is removed, and its removal will require some alternative mechanism of enforcing the shutdown contract described above.
- Vijay