]> git.proxmox.com Git - mirror_edk2.git/commitdiff
use nanosleep instead of usleep, ugaX11 calls msSleep instead of usleep
authortgingold <tgingold@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 13 Feb 2007 02:15:19 +0000 (02:15 +0000)
committertgingold <tgingold@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 13 Feb 2007 02:15:19 +0000 (02:15 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2376 6f19259b-4bc3-4df7-8a09-765794883524

EdkUnixPkg/Sec/UgaX11.c
EdkUnixPkg/Sec/UnixThunk.c

index b5719cfd596adeac8a635427bc5db4513a712ec5..47fb4fab7ac36e365232805302cf342c62ff55bc 100644 (file)
@@ -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;
   }
 }
index 46b0e34c55d2df820d6814cfc52432d3f3f2ca6f..c1988faf591095da13a1f24bc54c0103c80cd5b5 100644 (file)
@@ -89,6 +89,18 @@ SetTimer (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs))
   settimer_callback = CallBack;
 }
 
+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)
 {
@@ -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)
 {