Codechange: Use platform independent C++11 function for sleeping on a thread.

This commit is contained in:
Michael Lutz
2019-03-17 11:05:53 +01:00
parent 94c5269fa7
commit ae748166d0
12 changed files with 17 additions and 25 deletions

View File

@@ -20,6 +20,15 @@
class OTTDThreadExitSignal { };
/**
* Sleep on the current thread for a defined time.
* @param milliseconds Time to sleep for in milliseconds.
*/
inline void CSleep(int milliseconds)
{
std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
}
/**
* Get number of processor cores in the system, including HyperThreading or similar.
* @return Total number of processor cores.