added thread synchronization to ThreadingRPCClient