Initial revision
[wmaker-crm.git] / WINGs / usleep.c
blob16a8d688a6bf99a103045bda1c02220819f2940e
3 #include "../src/config.h"
6 #ifdef HAVE_SYS_TIME_H
7 # include <sys/time.h>
8 #endif
10 #ifdef _AIX
11 #include <sys/select.h>
12 #endif
14 #ifdef HAVE_SYS_TYPES_H
15 # include <sys/types.h>
16 #endif
18 #if defined(HAVE_SELECT)
22 void
23 wusleep(unsigned int microsecs)
25 struct timeval tv;
26 fd_set rd, wr, ex;
27 FD_ZERO(&rd);
28 FD_ZERO(&wr);
29 FD_ZERO(&ex);
30 tv.tv_sec = microsecs / 1000000u;
31 tv.tv_usec = microsecs % 1000000u;
32 select(1, &rd, &wr, &ex, &tv);
35 #else /* not HAVE_SELECT */
37 # ifdef HAVE_POLL
39 void
40 wusleep(unsigned int microsecs)
42 poll((struct poll *) 0, (size_t) 0, microsecs/1000);
45 # else /* ! HAVE_POLL */
47 oops!
49 # endif /* !HAVE_POLL */
50 #endif /* !HAVE_SELECT */