Necessary for multi-threaded commands like "nix verify-paths".
The latter is supposed to be more efficient.
This allows a RemoteStore object to be used safely from multiple threads concurrently. It will make multiple daemon connections if necessary. Note: pool.hh and sync.hh have been copied from the Hydra source tree.