(file) Return to sleep.h CVS log (file) (dir) Up to [OMI] / omi / pal

 1 krisbash 1.1 #ifndef _pal_sleep_h
 2              #define _pal_sleep_h
 3              
 4              #include "palcommon.h"
 5              
 6              #if defined(PAL_HAVE_POSIX)
 7              # include <unistd.h>
 8              # include <time.h>
 9              #endif
10              
11              PAL_BEGIN_EXTERNC
12              
13              PAL_INLINE void Sleep_Milliseconds(
14                  _In_ unsigned long milliseconds)
15              {
16              #if defined(_MSC_VER)
17                  Sleep((DWORD)milliseconds);
18              #else
19                  struct timespec ts;
20                  ts.tv_sec = (long)(milliseconds / 1000);
21                  ts.tv_nsec = (long)((milliseconds % 1000) * 1000 * 1000);
22 krisbash 1.1     nanosleep(&ts, NULL);
23              #endif
24              }
25              
26              /* invalid time value;
27                based on 'memset(0) to init' philosophy; this value must be 0;
28                do not re-assign it */
29              #define TIME_NEVER  0
30              
31              /* returns current time in micro-sec (usec) since Epoch */
32              PAL_Boolean PAL_Time(
33                  PAL_Uint64* time_usec);
34              
35              PAL_END_EXTERNC
36              
37              #endif /* _pal_sleep_h */

ViewCVS 0.9.2