mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-05 05:14:13 +01:00
- Change the wusleep abomination to be a simple wrapper around nanosleep (man says it's been POSIX for almost a decade) - Remove autoconf tests that became unnecessary along the way Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
26 lines
417 B
C
26 lines
417 B
C
|
|
#include <errno.h>
|
|
#include <time.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;
|
|
|
|
while (nanosleep(&tm, &tm) == -1 && errno == EINTR)
|
|
;
|
|
|
|
}
|
|
|