diff options
author | Michael Lutz <michi@icosahedron.de> | 2019-03-17 11:05:53 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2019-04-06 11:27:39 +0200 |
commit | ae748166d06e756a0a6abab582dc341494a9b2da (patch) | |
tree | d4c75246740f2e2ddd6978a6b14b17ac84bc27cf /src/thread.h | |
parent | 94c5269fa772304112b7c40d2c84794056f87717 (diff) | |
download | openttd-ae748166d06e756a0a6abab582dc341494a9b2da.tar.xz |
Codechange: Use platform independent C++11 function for sleeping on a thread.
Diffstat (limited to 'src/thread.h')
-rw-r--r-- | src/thread.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/thread.h b/src/thread.h index 086e2f51e..cd2608221 100644 --- a/src/thread.h +++ b/src/thread.h @@ -21,6 +21,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. */ |