[PATCH v2 07/13] rpc: finish all threads before exiting main loop