This change helps generalize shutdown code so an interrupt can be
provided to libbitcoinkernel callers. This may also be useful to
eventually de-globalize all of the shutdown code.
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
Co-authored-by: TheCharlatan <seb.kung@gmail.com>
This is a partial backport of core#27861
https://github.com/bitcoin/bitcoin/pull/27861/commits/e2d680a32d757de0ef8eb836047a0daa1d82e3c4
Depends on D18964