Refactor some threads related code.
This is a code style change that moves some pure thread code into the threads class.
It is a bit more code, but it makes search.cpp cleaner and easier to read by hiding some thread specific functionality.
STC (SMP)
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 75896 W: 12073 L: 12026 D: 51797
Ptnml(0-2): 828, 8224, 19872, 8121, 903
https://tests.stockfishchess.org/tests/view/5ed492e8f29b40b0fc95a74c
closes https://github.com/official-stockfish/Stockfish/pull/2720
No functional change.