Backport of core [[https://github.com/bitcoin/bitcoin/pull/15849 | PR15849]].
The first commit disables `thread_local` on some platforms and is not
not ported:
- The Darwin exclusion is no longer needed since D5514.
- The MinGw exclusion does not seem necessary, at least with our
version version. The tests run fine on Windows, both 32 and 64 bits.
The tests run fine on Windows, both 32 and 64 bitsAlso see D2219 which removes the `thread_local` check.
This introduces a number of bugs:
- This is breaking the build for some *BSD.
- This makes some Unix tools inefficient, like `ps` or `killall`.
- Some thread names are truncated and cannot be differentiated.
The fixes will be ported in their own diff for readability.