Commit 839db6dc authored by Stefan Tauner's avatar Stefan Tauner
Browse files

Use nanosleep() instead of usleep() where available


Usleep() has been obsolete for quite a while.
The only target that uses it without alternative is DOS.

Corresponding to flashrom svn r1899.
Signed-off-by: default avatarStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: default avatarStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
parent 8cd0c73f
......@@ -22,6 +22,7 @@
#ifndef __LIBPAYLOAD__
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
#include <stdlib.h>
#include <limits.h>
......@@ -174,9 +175,11 @@ void internal_sleep(unsigned int usecs)
{
#if IS_WINDOWS
Sleep((usecs + 999) / 1000);
#else
#elif defined(__DJGPP__)
sleep(usecs / 1000000);
usleep(usecs % 1000000);
#else
nanosleep(&(struct timespec){usecs / 1000000, (usecs * 1000) % 1000000000UL}, NULL);
#endif
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment