Instead of polling, use a semaphore (on WIN32) or a pipe (on POSIX) for shutdown notification. This avoids the need for a polling loop in bitcoind.
Extends #13186.
This does not change the polilng of ShutdownRequested()
in the GUI. This is more complicated: on POSIX it would be possible to import the pipe[0]
handle into the event loop, and call a handler when a character is detected, on Windows the StartShutdown()
could make a callback that queues a qt signal at the GUI side. But I think that is better left for a later PR.