[PATCH 05/10] rpc: finish all threads before exiting main loop