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

File: [OMI] / omi / pal / sleep.h (download)
Revision: 1.1, Mon Apr 20 17:19:55 2015 UTC (9 years ago) by krisbash
Branch: MAIN
CVS Tags: OMI_1_0_8_2, OMI_1_0_8_1, HEAD
OMI 1.0.8-1

#ifndef _pal_sleep_h
#define _pal_sleep_h

#include "palcommon.h"

#if defined(PAL_HAVE_POSIX)
# include <unistd.h>
# include <time.h>
#endif

PAL_BEGIN_EXTERNC

PAL_INLINE void Sleep_Milliseconds(
    _In_ unsigned long milliseconds)
{
#if defined(_MSC_VER)
    Sleep((DWORD)milliseconds);
#else
    struct timespec ts;
    ts.tv_sec = (long)(milliseconds / 1000);
    ts.tv_nsec = (long)((milliseconds % 1000) * 1000 * 1000);
    nanosleep(&ts, NULL);
#endif
}

/* invalid time value;
  based on 'memset(0) to init' philosophy; this value must be 0;
  do not re-assign it */
#define TIME_NEVER  0

/* returns current time in micro-sec (usec) since Epoch */
PAL_Boolean PAL_Time(
    PAL_Uint64* time_usec);

PAL_END_EXTERNC

#endif /* _pal_sleep_h */

ViewCVS 0.9.2