X-Git-Url: https://repo.or.cz/w/wmaker-crm.git/blobdiff_plain/59fc927dc9f183802621138534fa6eaafe5593ba..688a56e8ab67b56550e2874d9d7423f0d435bfd9:/WINGs/usleep.c diff --git a/WINGs/usleep.c b/WINGs/usleep.c dissimilarity index 61% index 4d250b30..792b9475 100644 --- a/WINGs/usleep.c +++ b/WINGs/usleep.c @@ -1,52 +1,46 @@ - - -#include "wconfig.h" - - -#ifdef HAVE_SYS_TIME_H -# include -#endif - -#ifdef HAVE_SYS_TYPES_H -# include -#endif - - -#include -#include - -#if defined(HAVE_SELECT) - -#ifdef HAVE_SYS_SELECT_H -# include -#endif - -void -wusleep(unsigned int microsecs) -{ - struct timeval tv; - fd_set rd, wr, ex; - FD_ZERO(&rd); - FD_ZERO(&wr); - FD_ZERO(&ex); - tv.tv_sec = microsecs / 1000000u; - tv.tv_usec = microsecs % 1000000u; - select(1, &rd, &wr, &ex, &tv); -} - -#else /* not HAVE_SELECT */ - -# ifdef HAVE_POLL - -void -wusleep(unsigned int microsecs) -{ - poll((struct poll *) 0, (size_t) 0, microsecs/1000); -} - -# else /* ! HAVE_POLL */ - -oops! - -# endif /* !HAVE_POLL */ -#endif /* !HAVE_SELECT */ + +#include "wconfig.h" + +#ifdef HAVE_SYS_TIME_H +# include +#endif + +#ifdef HAVE_SYS_TYPES_H +# include +#endif + +#include +#include + +#if defined(HAVE_SELECT) + +#ifdef HAVE_SYS_SELECT_H +# include +#endif + +void wusleep(unsigned int microsecs) +{ + struct timeval tv; + fd_set rd, wr, ex; + FD_ZERO(&rd); + FD_ZERO(&wr); + FD_ZERO(&ex); + tv.tv_sec = microsecs / 1000000u; + tv.tv_usec = microsecs % 1000000u; + select(1, &rd, &wr, &ex, &tv); +} + +#else /* not HAVE_SELECT */ + +# ifdef HAVE_POLL + +void wusleep(unsigned int microsecs) +{ + poll((struct poll *)0, (size_t) 0, microsecs / 1000); +} + +# else /* ! HAVE_POLL */ + +oops ! +# endif /* !HAVE_POLL */ +#endif /* !HAVE_SELECT */