diff options
author | tgingold <tgingold@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-02-13 02:15:19 +0000 |
---|---|---|
committer | tgingold <tgingold@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-02-13 02:15:19 +0000 |
commit | 8ba2f4413a21d5dd3d4833aa097b918aa5cfb8a7 (patch) | |
tree | e98ea8ba6ebf1010d45be581952038d964aebe7b /EdkUnixPkg | |
parent | 6a352324b99bf3c5e5b221781e9926c81c311748 (diff) | |
download | edk2-platforms-8ba2f4413a21d5dd3d4833aa097b918aa5cfb8a7.tar.xz |
use nanosleep instead of usleep, ugaX11 calls msSleep instead of usleep
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2376 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkUnixPkg')
-rw-r--r-- | EdkUnixPkg/Sec/UgaX11.c | 4 | ||||
-rw-r--r-- | EdkUnixPkg/Sec/UnixThunk.c | 18 |
2 files changed, 15 insertions, 7 deletions
diff --git a/EdkUnixPkg/Sec/UgaX11.c b/EdkUnixPkg/Sec/UgaX11.c index b5719cfd59..47fb4fab7a 100644 --- a/EdkUnixPkg/Sec/UgaX11.c +++ b/EdkUnixPkg/Sec/UgaX11.c @@ -13,6 +13,8 @@ #include <stdio.h> #include <stdlib.h> +extern void msSleep (unsigned long Milliseconds); + /* XQueryPointer */ struct uga_drv_shift_mask @@ -347,7 +349,7 @@ UgaCheckKey(EFI_UNIX_UGA_IO_PROTOCOL *UgaIo) return EFI_SUCCESS; else { /* EFI is certainly polling. Be CPU-friendly. */ - usleep (50000); + msSleep (20); return EFI_NOT_READY; } } diff --git a/EdkUnixPkg/Sec/UnixThunk.c b/EdkUnixPkg/Sec/UnixThunk.c index 46b0e34c55..c1988faf59 100644 --- a/EdkUnixPkg/Sec/UnixThunk.c +++ b/EdkUnixPkg/Sec/UnixThunk.c @@ -90,6 +90,18 @@ SetTimer (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs)) } void +msSleep (unsigned long Milliseconds) +{ + struct timespec ts; + + ts.tv_sec = Milliseconds / 1000; + ts.tv_nsec = (Milliseconds % 1000) * 1000000; + + while (nanosleep (&ts, &ts) != 0 && errno == EINTR) + ; +} + +void GetLocalTime (EFI_TIME *Time) { struct tm *tm; @@ -110,12 +122,6 @@ GetLocalTime (EFI_TIME *Time) | (tm->tm_isdst > 0 ? EFI_TIME_IN_DAYLIGHT : 0); } -void -msSleep (unsigned long Milliseconds) -{ - usleep (Milliseconds * 1000); -} - static void TzSet (void) { |