Platform-dependent sleep routines


/ Published in: C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // Platform-dependent sleep routines.
  2. #if defined(__WINDOWS_MM__)
  3. #include <windows.h>
  4. #define SLEEP( milliseconds ) Sleep( (DWORD) milliseconds )
  5. #else // Unix variants
  6. #include <unistd.h>
  7. #define SLEEP( milliseconds ) usleep( (unsigned long) (milliseconds * 1000.0) )
  8. #endif

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.