WINGs: Added 'const' attribute to function 'WMCreateHashTable'
[wmaker-crm.git] / WINGs / usleep.c
blob99d07912a3306922d8c3b5d03f01d8db202a8633
2 #include <errno.h>
3 #include <time.h>
5 #include "WUtil.h"
6 #include "wconfig.h"
8 void wusleep(unsigned int usec)
10 struct timespec tm;
12 /* An arbitrary limit of 10 minutes -- in WM, if
13 * somethings wants to sleep anything even close to
14 * this, it's most likely an error.
16 if (usec > 600000000)
17 return;
19 tm.tv_sec = usec / 1000000;
20 tm.tv_nsec = (usec % 1000000) * 1000;
22 while (nanosleep(&tm, &tm) == -1 && errno == EINTR)