implement a platform neutral usleep() using C++11

This commit is contained in:
Axel Kohlmeyer
2021-10-05 17:58:27 -04:00
parent 528050aa08
commit fcdabe0002
3 changed files with 22 additions and 4 deletions

View File

@ -61,7 +61,9 @@
#endif
////////////////////////////////////////////////////////////////////////
#include <chrono>
#include <cstring>
#include <thread>
/* ------------------------------------------------------------------ */
@ -172,6 +174,14 @@ double platform::walltime()
return wtime;
}
/* ----------------------------------------------------------------------
sleep with microsecond resolution
------------------------------------------------------------------------ */
void platform::usleep(int usec)
{
return std::this_thread::sleep_for(std::chrono::microseconds(usec));
}
/* ----------------------------------------------------------------------
get Operating system and version info
------------------------------------------------------------------------- */