mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-26 22:52:34 +02:00
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: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
This commit is contained in:
parent
8cd0c73fb5
commit
839db6dccd
5
udelay.c
5
udelay.c
@ -22,6 +22,7 @@
|
|||||||
#ifndef __LIBPAYLOAD__
|
#ifndef __LIBPAYLOAD__
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
@ -174,9 +175,11 @@ void internal_sleep(unsigned int usecs)
|
|||||||
{
|
{
|
||||||
#if IS_WINDOWS
|
#if IS_WINDOWS
|
||||||
Sleep((usecs + 999) / 1000);
|
Sleep((usecs + 999) / 1000);
|
||||||
#else
|
#elif defined(__DJGPP__)
|
||||||
sleep(usecs / 1000000);
|
sleep(usecs / 1000000);
|
||||||
usleep(usecs % 1000000);
|
usleep(usecs % 1000000);
|
||||||
|
#else
|
||||||
|
nanosleep(&(struct timespec){usecs / 1000000, (usecs * 1000) % 1000000000UL}, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user