Use RPC in a thread