]> git.proxmox.com Git - mirror_edk2.git/commitdiff
StdLib|LibC: Implement the sleep() function.
authordarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 11 Sep 2011 20:09:02 +0000 (20:09 +0000)
committerdarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 11 Sep 2011 20:09:02 +0000 (20:09 +0000)
Implement the sleep() function and make both sleep() and usleep() public.  Required initially for Python, but these functions have general applicability.

Signed-off-by: duanev@gmail.com
Reviewed-by: darylm503
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12323 6f19259b-4bc3-4df7-8a09-765794883524

StdLib/Include/unistd.h
StdLib/LibC/Uefi/select.c

index df78690525139b7076bc319b293517a846eedd39..2134f157657c1380e5664ea7f9ef88acce485ca2 100644 (file)
@@ -37,6 +37,8 @@ extern   int    optind;
 pid_t           getpgrp(void);\r
 pid_t           tcgetpgrp(int);\r
 char           *getpass(const char *);\r
+int             usleep(useconds_t);\r
+unsigned int    sleep(unsigned int);\r
 \r
 // Networking\r
 long            gethostid(void);\r
@@ -84,7 +86,6 @@ int             setgid(gid_t);
 int             setpgid(pid_t, pid_t);\r
 pid_t           setsid(void);\r
 int             setuid(uid_t);\r
-unsigned int    sleep(unsigned int);\r
 long            sysconf(int);\r
 \r
 int             tcsetpgrp(int, pid_t);\r
@@ -127,7 +128,6 @@ void            swab(const void *, void *, size_t);
 int             symlink(const char *, const char *);\r
 void            sync(void);\r
 useconds_t      ualarm(useconds_t, useconds_t);\r
-int             usleep(useconds_t);\r
 pid_t           vfork(void) __RENAME(__vfork14);\r
 \r
 /*\r
index 8da03e65d024f8d74375244340d16680ca4ac75a..830e011e0da5aedc2859df5431189eb7fbde06d6 100644 (file)
 \r
 #define MAX_SLEEP_DELAY 0xfffffffe\r
 \r
-//\r
-//  Name:\r
-//      usleep\r
-//\r
-//  Description:\r
-//      Implement usleep(3) function.\r
-//\r
-//  Arguments:\r
-//      Microseconds to sleep.\r
-//\r
-//  Returns:\r
-//      0\r
-//\r
+/** Sleep for the specified number of Microseconds.\r
+\r
+    Implements the usleep(3) function.\r
+\r
+    @param[in]    Microseconds    Number of microseconds to sleep.\r
+\r
+    @retval   0   Always returns zero.\r
+**/\r
 int\r
 usleep( useconds_t Microseconds )\r
 {\r
@@ -98,6 +93,12 @@ usleep( useconds_t Microseconds )
   return (0);\r
 }\r
 \r
+unsigned int\r
+sleep( unsigned int Seconds )\r
+{\r
+  return (usleep( useconds_t(Seconds * 1000000) ));\r
+}\r
+\r
 static int\r
 selscan(\r
   fd_mask **ibits,\r