few more fixes to std colormap code
[wmaker-crm.git] / WINGs / usleep.c
blob3ab784d45236e298c84be7a28e1c6de81c55fb42
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 #include <unistd.h>
16 #include <string.h>
18 #if defined(HAVE_SELECT)
20 #ifdef HAVE_SYS_SELECT_H
21 # include <sys/select.h>
22 #endif
24 void
25 wusleep(unsigned int microsecs)
27 struct timeval tv;
28 fd_set rd, wr, ex;
29 FD_ZERO(&rd);
30 FD_ZERO(&wr);
31 FD_ZERO(&ex);
32 tv.tv_sec = microsecs / 1000000u;
33 tv.tv_usec = microsecs % 1000000u;
34 select(1, &rd, &wr, &ex, &tv);
37 #else /* not HAVE_SELECT */
39 # ifdef HAVE_POLL
41 void
42 wusleep(unsigned int microsecs)
44 poll((struct poll *) 0, (size_t) 0, microsecs/1000);
47 # else /* ! HAVE_POLL */
49 oops!
51 # endif /* !HAVE_POLL */
52 #endif /* !HAVE_SELECT */