Mac OS X-style window cycling.
[wmaker-crm.git] / WINGs / usleep.c
blob792b94755062fff5083ca39d5034e6363cf309cc
2 #include "wconfig.h"
4 #ifdef HAVE_SYS_TIME_H
5 # include <sys/time.h>
6 #endif
8 #ifdef HAVE_SYS_TYPES_H
9 # include <sys/types.h>
10 #endif
12 #include <unistd.h>
13 #include <string.h>
15 #if defined(HAVE_SELECT)
17 #ifdef HAVE_SYS_SELECT_H
18 # include <sys/select.h>
19 #endif
21 void wusleep(unsigned int microsecs)
23 struct timeval tv;
24 fd_set rd, wr, ex;
25 FD_ZERO(&rd);
26 FD_ZERO(&wr);
27 FD_ZERO(&ex);
28 tv.tv_sec = microsecs / 1000000u;
29 tv.tv_usec = microsecs % 1000000u;
30 select(1, &rd, &wr, &ex, &tv);
33 #else /* not HAVE_SELECT */
35 # ifdef HAVE_POLL
37 void wusleep(unsigned int microsecs)
39 poll((struct poll *)0, (size_t) 0, microsecs / 1000);
42 # else /* ! HAVE_POLL */
44 oops !
45 # endif /* !HAVE_POLL */
46 #endif /* !HAVE_SELECT */