_export void
p4_delay (int ms)
{
#if !defined VxWorks
# if defined PFE_HAVE_DELAY
delay (ms);
# elif defined EMX
_sleep2 (ms);
# elif defined PFE_HAVE_USLEEP
usleep (ms * 1000);
# elif defined PFE_HAVE_WINBASE_H
Sleep (ms);
# elif defined PFE_HAVE_POLL
static struct pollfd dummy = { 0, POLLHUP, POLLHUP };
poll (&dummy, 1, ms);
# elif defined PFE_HAVE_SELECT || defined PFE_HAVE_SYS_SELECT_H
struct timeval tval;
tval.tv_sec = ms / 1000;
tval.tv_usec = ms % 1000 * 1000;
select (0, NULL, NULL, NULL, &tval);
# else
sleep ((ms + 999) / 1000);
# endif
#else
# ifndef NANOSLEEP_BUG
struct timespec rqtp;
rqtp.tv_sec = (time_t) (ms / 1000);
rqtp.tv_nsec = (long) (ms % 1000) * 1000000;
nanosleep (&rqtp, 0);
# else
int clocks = CLOCKS_PER_SEC*ms/1000;
if (clocks) {
taskDelay (clocks);
}
# endif
#endif
} |