Yes there is. What you do is transfer the various sleep system calls to your own function, as well as include statements, as shown below:
#ifdef LINUX #include <unistd.h> #endif #ifdef WINDOWS #include <windows.h> #endif void mySleep(int sleepMs) { #ifdef LINUX usleep(sleepMs * 1000); // usleep takes sleep time in us (1 millionth of a second) #endif #ifdef WINDOWS Sleep(sleepMs); #endif }
Your code then calls mySleep for sleep, not for direct system calls.
shf301 Jun 06 '12 at 16:38 2012-06-06 16:38
source share