Apologies for the plumbing-only no-changes PR, but the “move wallet updates out of cs_main into a background thread” changeset is a bit big for all one go, so instead I’m doing this first. It simply gives CValidationInterface the neccessary plumbing to handle callbacks on the CScheduler thread. See https://github.com/TheBlueMatt/bitcoin/commit/4e82e409fbf3473f94dfa8cffe2674e853d59054 for a commit which switches a callback into the background thread.
The CScheduler thread was super lonely, so I decided to use that instead of adding new threads.
This conflicts trivially with #10178, but not enough to avoid doing parallel reviews. After that and this are merged, “move wallet callbacks into background thread” is just one more (somewhat large, sadly) PR away. See https://github.com/TheBlueMatt/bitcoin/commits/2017-01-wallet-cache-inmempool for the full branch.