1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 12:00:31 +01:00
Files
wmaker/WINGs/usleep.c
Christophe CURIS 140249ad0c WINGs: Added include for header defining the funcion provided by the file
This allows the compiler to warn if the definition in the file is
no in line with what is exposed to the users of the function through
the header definition.
2013-05-12 01:01:20 +01:00

27 lines
445 B
C

#include <errno.h>
#include <time.h>
#include "WUtil.h"
#include "wconfig.h"
void wusleep(unsigned int usec)
{
struct timespec tm;
/* An arbitrary limit of 10 minutes -- in WM, if
* somethings wants to sleep anything even close to
* this, it's most likely an error.
*/
if (usec > 600000000)
return;
tm.tv_sec = usec / 1000000;
tm.tv_nsec = (usec % 1000000) * 1000;
while (nanosleep(&tm, &tm) == -1 && errno == EINTR)
;
}