Updating to version 0.20.2
[wmaker-crm.git] / WINGs / usleep.c
blob4c5246de93d077bd4d41cbf48e732fa4647db257
3 #include "../src/config.h"
6 #ifdef HAVE_SYS_TIME_H
7 # include <sys/time.h>
8 #endif
10 #ifdef HAVE_SYS_TYPES_H
11 # include <sys/types.h>
12 #endif
15 #if defined(HAVE_SELECT)
17 #ifdef HAVE_SYS_SELECT_H
18 # include <sys/select.h>
19 #endif
21 void
22 wusleep(unsigned int microsecs)
24 struct timeval tv;
25 fd_set rd, wr, ex;
26 FD_ZERO(&rd);
27 FD_ZERO(&wr);
28 FD_ZERO(&ex);
29 tv.tv_sec = microsecs / 1000000u;
30 tv.tv_usec = microsecs % 1000000u;
31 select(1, &rd, &wr, &ex, &tv);
34 #else /* not HAVE_SELECT */
36 # ifdef HAVE_POLL
38 void
39 wusleep(unsigned int microsecs)
41 poll((struct poll *) 0, (size_t) 0, microsecs/1000);
44 # else /* ! HAVE_POLL */
46 oops!
48 # endif /* !HAVE_POLL */
49 #endif /* !HAVE_SELECT */